uni.getSystemInfoSync().platform 返回值均为 devtools,判断运行环境,根据不同环境执行不同程序。
getMap(e) {
var that = this;
switch (uni.getSystemInfoSync().platform) {
case 'android':
var id = e.currentTarget.id;
var maps = uni.createMapContext(id, this).$getAppMap();
maps.onclick = function(point) {
console.log(point);
that.lon = point.longitude
that.lat = point.latitude
that.covers[0].latitude = point.latitude
that.covers[0].longitude = point.longitude
}
break;
case 'ios':
break;
default:
console.log('地图信息', e)
that.lon = e.detail.longitude
that.lat = e.detail.latitude
that.covers[0].latitude = e.detail.latitude
that.covers[0].longitude = e.detail.longitude
break;
}
},