问题:微信小程序map打开背景蓝色,右下角显示here,
解决方法:调试发现在mounted方法使用.marker.push 造成,应该是微信的bug,改成nextTick 延时去生成marker,可解决
mounted() {
//this._mapContext = uni.createMapContext("map", this);
let mapContext = wx.createMapContext("map", this)
this.$nextTick(() => {
setTimeout(() => {
if (!stringUtils.isEmpty(this.shippingInfor)) {
this.latitude = this.shippingInfor.latitude
this.longitude = this.shippingInfor.longitude
this.marker.push({
id: 0,
latitude: this.shippingInfor.latitude, //纬度
longitude: this.shippingInfor.longitude, //经度
iconPath: '/static/images/icon_map_ship.png', //显示的图标
width: 25, //宽
height: 30, //高
})
}
this.scale = 12
}, 1500)
})
},