最近要实现一个地图的效果,地图外有个外边框,配置项无此配置,在网上看到的效果,还须要积分下载,顿时感受很很差,互联网之因此发展到如此,我的感受是由于 "分享" 。找不到就本身实现咯。spa
换个思路实现起来也很简单,好比设计图是这个样子:设计
你以为边框很差实现,可是你会不会实现下面两种样子3d
若是你说你都会,那么问题就解决了,两个重叠一下就是你想要的效果(center,aspectScale和zoom须要同样),附上关键代码:code
geo: { map: 'china', center: [112.194115019531, 23.582111640625], zoom: 12, aspectScale: 1, //长宽比 label: { normal: { show: true, textStyle: { fontSize: 16, color: '#ccc' } }, emphasis: { show: false, textStyle: { color: '#ccc' } } }, roam: false, itemStyle: { normal: { borderColor: "#fff", borderWidth: 5, areaColor: '#272235', fontWeightL: 700, /* shadowBlur:20, shadowColor: '#fff',*/ }, emphasis: { areaColor: { type: 'linear', x: 0, y: 0, x2: 0, y2: 1, colorStops: [{ offset: 0, color: '#3f15d6' // 0% 处的颜色 }, { offset: 1, color: '#d243cd' // 100% 处的颜色 }], globalCoord: false // 缺省为 false } } } }, series: [ { type: 'map', map: 'china', center: [112.194115019531, 23.582111640625], zoom: 12, geoIndex: 1, aspectScale: 1, //长宽比 showLegendSymbol: false, // 存在legend时显示 label: { normal: { show: true, textStyle: { fontSize: 16, color: '#ccc' } }, emphasis: { show: false, textStyle: { color: '#ccc' } } }, roam: false, itemStyle: { normal: { areaColor: '#272235', borderColor: '#fff', fontWeightL: 700, borderWidth: 1 }, emphasis: { areaColor: { type: 'linear', x: 0, y: 0, x2: 0, y2: 1, colorStops: [{ offset: 0, color: '#3f15d6' // 0% 处的颜色 }, { offset: 1, color: '#d243cd' // 100% 处的颜色 }], globalCoord: false // 缺省为 false } } }, data: [] } ]
若是想实现阴影就把底层map的边框改为阴影orm
本篇如能对您有所帮助,实在是感到荣幸。若有不合理之处也请你们多多指点blog