注意:map组件如果放在uni-popup里面会有层级问题,造成不显示的问题,我是直接放在根元素下面,控制显隐解决的
<map ref='popMap' v-show="popShow" id="popMap"
style="width:680rpx;box-sizing: border-box; height: 60vh;position: absolute;z-index: 1000; bottom:200rpx "
:latitude="latitude" :longitude="longitude" :markers="markers" @tap='addSite'>
</map>
addMapEvent() {
let that = this;
var maps = uni.createMapContext("popMap", this).$getAppMap();
maps.onclick = function(point) {
console.log(point);
that.lon = point.longitude
that.lat = point.latitude
that.markers = [];
that.markers = [{
id: 1,
latitude: point.latitude,
longitude: point.longitude,
iconPath: marker,
title: "我的位置"
}]
}
},
网友评论