//点击导航
toNavigator() {
const latitude=this.data.Store.lat,
longitude=this.data.Store.lng,
address =this.data.Store.Address,
name=this.data.Store.Name;
wx.getSetting({
success: (res) => {
if (res.authSetting['scope.userLocation'] != undefined && res.authSetting['scope.userLocation'] != true) {
wx.showModal({
title: '是否授权当前位置',
content: '需要获取您的地理位置,请确认授权,否则地图定位功能将无法使用',
success: function (res) {
if (res.cancel) {
wx.showToast({
title: '授权失败',
icon: 'none',
duration: 5000
})
} else if (res.confirm) {
wx.openSetting({
success: function (data) {
if (data.authSetting["scope.userLocation"] == true) {
wx.showToast({
title: '授权成功',
icon: 'success',
duration: 5000
})
wx.openLocation({
latitude: parseFloat(latitude),
longitude: parseFloat(longitude),
name: name,
address:address, //详细地址
scale: 28 //缩放比例,范围5~18
})
} else {
wx.showToast({
title: '授权失败',
icon: 'success',
duration: 5000
})
}
}
})
}
}
})
} else {
wx.openLocation({
latitude: parseFloat(latitude),
longitude: parseFloat(longitude),
name: name,
address:address, //详细地址
scale: 28 //缩放比例,范围5~18
})
}
}
})
},
使用小程序内置地图
于 2022-08-15 10:31:35 首次发布