先准备好有经纬度的json文件
[
{
"name": "椒江区白云街道南山公墓",
"value": [
121.418228,
28.664811
]
},
{
"name": "乌石村公益性公墓",
"value": [
121.382656,
28.676588
]
},
]
在地图页引入
import cemetery from './cemetery.json'
代码写法
series: [
...
{
name: '',
type: 'scatter',
coordinateSystem: 'geo',
symbol: 'image://' + require('../images/zuobiao.png'), // 图标路径
symbolSize: [23, 30], // 图标大小
label: {
normal: {
show: true,
textStyle: {
color: '#fff',
fontSize: 9
},
formatter(value) { //悬浮展示内容
return ''
}
}
},
data: cemetery,
showEffectOn: 'render',
rippleEffect: {
brushType: 'stroke'
},
hoverAnimation: true,
zlevel: 1
}
]