MapContext.addGroundOverlay 添加两个图层后 ,IOS 丢失图层?
Page({
/**
* 页面的初始数据
*/
data: {
longitude:117.380771,
latitude:37.814422,
markers: [{
}]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function () {
this.mapCtx = wx.createMapContext('mapId')
// 自定义背景
this.mapCtx.addGroundOverlay(
{
id: 1,
src: "../images/home/map-3.png",
bounds: {
northeast: { //东北角
latitude: 37.819788,
longitude: 117.383956,
},
southwest: { //西南角
latitude: 37.809342,
longitude: 117.377628,
},
},
visible: true,
zIndex: 1,
success(res){
console.log('wp', res)
},
fail(err){
console.log('wperr', err)
}
}
)
// 四合院
this.mapCtx.addGroundOverlay({
id: 2,
src: "../images/guide/icon-siheyuan.png",
bounds: {
northeast: { //东北角
latitude: 37.817685,
longitude: 117.379101,
},
southwest: { //西南角
latitude: 37.817167,
longitude: 117.378499,
}
},
visible: true,
zIndex: 2,
success(res) {
console.log('wp2', res.errMsg)
},
fail(error) {
console.log('wp2', res.errMsg)
},
complete(res) {
console.log(res);
},
})
},
})