<map style="width: 100%; height: 300px;" :latitude="latitude" :longitude="longitude" :markers="markers" @markertap="markertap"
@callouttap="callouttap" :polyline="polylines" show-location :enable-traffic="true"> </map>
data() {
return {
remnant:0,
content:"",
title:"",
role:false,
latitude: 39.909,
longitude: 116.39742,
markers: [{
width: 40,
height: 40,
latitude: 39.9345,
longitude: 119.61063,
iconPath: '../../static/logo.png',
id: 1,
customCallout: {
anchorX: 0,
anchorY: 0,
display: "BYCLICK"
}
},
{
width: 40,
height: 40,
latitude: 39.989,
longitude: 116.39742,
iconPath: '../../static/logo.png',
id: 2,
callout: {
color: '#ffffff',
content: '氣泡內容',
fontSize: 16,
borderRadius: 5,
bgColor: '#FF0000',
padding: 20,
textAlign: 'center',
display: "BYCLICK"
}
}
],
polylines: [],
markers: [], //標記點數組
Location() { //本地位置權限獲取
let that = this
wx.getLocation({
type: 'gcj02',
timeout:"1000",
success(res) {
console.log(res)
that.latitude = res.latitude
that.longitude = res.longitude
// that.markers[0].latitude = res.latitude
// that.markers[0].longitude = res.longitude
const speed = res.speed
const accuracy = res.accuracy
}
})
},