下列是相关代码:
var jingdu=null;
var weidu=null;
Page({
data: {
jingdu:null,
weidu:null,
markers: [{
iconPath: "/resources/others.png",
id: 0,
latitude: null,
longitude: null,
width: 50,
height: 50
}],
polyline: [{
points: [{
longitude: 113.3245211,
latitude: 23.10229
}, {
longitude: 113.324520,
latitude: 23.21229
}],
color:"#FF0000DD",
width: 2,
dottedLine: true
}],
controls: [{
id: 1,
iconPath: '/resources/location.png',
position: {
left: 0,
top: 300 - 50,
width: 50,
height: 50
},
clickable: true
}]
},
regionchange(e) {
console.log(e.type)
},
markertap(e) {
console.log(e.detail.markerId)
},
controltap(e) {
console.log(e.detail.controlId)
},
onLoad:function(){
if (!wx.cloud) {
wx.redirectTo({
url: '../chooseLib/chooseLib',
})
return
}
wx.getSetting({
success: res => {
if (res.authSetting['scope.userInfo']) {
wx.getUserInfo({
success: res => {
console.log("授权成功 "+res)
console.log(res)
wx.getLocation({
success: res => {
console.log(res)
this.setData({
'markers[0].latitude':'res.latitude',
'markers[0].longitude':'res.longitude',
jingdu:res.longtitude,
weidu:res.latitude
})
console.log({jigndu})
console.log({weidu})
}
})
}
})
}
}
})
},
})
wwxml
<map id="map" longitude="{{jingdu}}" latitude="{{weidu}}" scale="14" controls="{{controls}}" bindcontroltap="controltap" markers="{{markers}}" bindmarkertap="markertap" polyline="{{polyline}}" bindregionchange="regionchange" show-location style="width: 100%; height:300px;"></map>
d地图是一片白的,错误我没看懂,说着没定义,但是这个jingdu是在data里面的啊,而且我也定义了var jingdu=null;
z这是错误信息
哈哈
j i n g d u
j i g n d u