uniapp
<view @tap="openLocation(peripheryinfo.latitude,peripheryinfo.longitude,peripheryinfo.address)">
打开导航
</view>
openLocation(latitude, longitude, village) {
uni.getLocation({
type: 'gcj02', //返回可以用于uni.openLocation的经纬度
success: function(res) {
uni.openLocation({
longitude: parseFloat(longitude),
latitude: parseFloat(latitude),
name: village,
success: function() {
console.log('success');
}
});
}
});
},
<map id="map"></map>
//定位偏移
anchor = {
x: 0.5,
y: 0.5
}
//回到当前位置
controltap() {
console.log(11111)
let mpCtx = wx.createMapContext("map");
mpCtx.moveToLocation();
},