mpvue地图连线代码备忘
<map id="map" longitude="113.324520" latitude="23.099994" scale="14" :markers="markers" :polyline="polyline" show-location></map>
data(){
return {
polyline: [{
points: [{
longitude: 113.3245211,
latitude: 23.10229
}, {
longitude: 113.324520,
latitude: 23.21229
}],
color: "#048FFFBB",
width: 2,
dottedLine: false
}]
}
},
methods:{
// 新增地图坐标点
addMarker(latitude, longitude) {
this.markers.push({
iconPath: "../../static/images/map/car_marker.png",
id: 0,
latitude: latitude,
longitude: longitude,
width: 26,
height: 30
})
this.polyline[0].points.push({
longitude: longitude,
latitude: latitude
})
this.moveToLocation()
}
}
转载自:https://blog.csdn.net/solocao/article/details/85308384