在data数据的name和address不能传出来,下面的名字和地址显示不出Page({
data: {
longitude: 113.14278,
latitude: 23.02882,
markers: [
{
id: 0,
iconPath: "/image/1.png",
latitude: 21.859222,
longitude: 111.975107,
name:'地点名称1',
address:'地址的详细说明',
width: 28,
height: 32,
callout:{
content:'lcw'
},
},
{
id: 1,
iconPath: "/image/1.png",
latitude: 23.051546,
longitude: 112.472529,
name:'地点名称1',
address:'地址的详细说明',
width: 28,
height: 32,
callout:{
content:'hxp'
},
},
{
id: 2,
iconPath: "/image/1.png",
latitude: 22.26654,
longitude: 113.5435,
name:'地点名称1',
address:'地址的详细说明',
width: 28,
height: 32,
callout:{
content:'hrs'
},
},
{
id: 3,
iconPath: "/image/1.png",
latitude: 21.37721,
longitude: 110.25003,
name:'地点名称1',
address:'地址的详细说明',
width: 28,
height: 32,
callout:{
content:'zzh'
},
},
{
id: 4,
iconPath: "/image/1.png",
latitude: 22.547,
longitude: 114.085947,
name:'地点名称1',
address:'地址的详细说明',
width: 28,
height: 32,
callout:{
content:'xpl',
},
},
]
},
onLoad(){
let that = this
wx.getLocation({
type: 'wgs84',
success(res) {
console.log(res)
that.setData({
lat:res.latitude,
lon:res.longitude,
})
}
})
},
bindmarkertap(e){
console.log(e.markerId)
this.data.markers.forEach((item)=>{
if (item.id == e.markerId){
wx.openLocation({
latitude: parseFloat(item.latitude),
longitude: parseFloat(item.longitude),
name: parseFloat(item.name),
address: parseFloat(item.address)
})
}
})
},
onReady: function () {
},
bindregionchange(e) {
console.log('=bindregiοnchange=', e)
},
bindtapMap(e) {
console.log('=bindtapMap=', e)
}
})
补充一个图片