收藏
回答

小程序体验版--打开调试位置调取成功,关闭vconsole调取地图失败

框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
小程序 Bug wx.openLocation 客户端 7.0.3 2.4.2


小程序体验版,打开位置按钮

wx.request({
     url: 'https://apis.map.qq.com/ws/geocoder/v1/?address=' + that.data.merAddress + '&key=K3GBZ-54X6Q-QWP5F-GPYT3-57EK3-LVFVV',
     method: 'GET',
     // header: {},
     success: function (res) {
       if (res.data.status == 0) {
         // success
         console.log("请求位置成功");
      
         that.setData({
           lng: res.data.result.location.lng,
           lat: res.data.result.location.lat
         });
         wx.openLocation({
           latitude: res.data.result.location.lat,
           longitude: res.data.result.location.lng,
           scale: 18,
           name: that.data.merchantStore.merStoreName,
           address: that.data.merchantStore.merAddress
         })
       }
     },
     fail: function () {
       // fail
       console.log("请求位置");
     }

打开调试vConsole可以调取内置地图查看位置,但是关闭vConsole调取失败,打开地图失败

回答关注问题邀请回答
收藏

2 个回答

登录 后发表内容