地图在开发工具中显示marker,但是在手机不显示marker
此问题在ios真机出现问题
代码片段
js文件
Page({
data: {
markers: []
},
regionchange(e) {
var that = this;
var ne = { latitude: 23.099994, longitude: 113.324520 };
wx.request({
url: url,
data: that.params(ne),
method: ‘POST’, // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
header: { “content-type”: “application/x-www-form-urlencoded” }, // 设置请求的 header
success: function (res) {
var datas = res.data;
var markers1 = [];
var i = 0;
for (;i<10;i++) {
var model = datas[i];
var marker = {
id: i++,
latitude: model.lat,
longitude: model.lng,
width: 30,
height: 33, title: model.n
};
markers1.push(marker)
}
that.setData({
markers: markers1
})
},
fail: function () {
// fail
},
complete: function () {
// complete
}
})
},
markertap(e) {
console.log(e.markerId)
},
controltap(e) {
console.log(e.controlId)
},
onLoad() {
var that = this;
that.map = wx.createMapContext(“map”);
}
})
wxml文件
<map id=“map”
longitude=“113.324520”
latitude=“23.099994”
scale=“14”
bindcontroltap=“controltap”
markers="{{markers}}"
bindmarkertap=“markertap”
polyline="{{polyline}}"
bindregionchange=“regionchange”
show-location style=“width: 100%; height: 300px;”></map>