- uni.getLocation({
- type: 'gcj02', //返回可以用于uni.openLocation的经纬度
- success: function (res) {
- const latitude = res.latitude;
- const longitude = res.longitude;
- uni.openLocation({
- latitude: latitude,
- longitude: longitude,
- success: function () {
- console.log('success');
- }
- });
- }
- });
- // 导航
- const openNavigator = v => {
- wx.openLocation({
- longitude: v.longitude,
- latitude: v.dimension,
- scale: 8,
- name: v.title || '公益小程序-XXX',
- address: `${v.province}${v.city}${v.county}${v.address}`
- })
- }
开发者工具和真机上打开的导航效果是有所不同的,开发者工具只是模拟导航效果,一切以真机效果为主