wx.chooseLocation,开发工具跟手机测试结果不一致
发布于 5 年前 作者 fang88 772 次浏览 来自 问答

  // 调取地图选点

  chooseLocation: function (e) {

    var that = this;

    var keymap = e.currentTarget.dataset.keymap;

    wx.chooseLocation({

      success: function (res) {

        var changeData = {};

        changeData[keymap + ‘.name’] = res.name;

        changeData[keymap + ‘.address’] = res.address;

        changeData[keymap + ‘.latitude’] = res.latitude;

        changeData[keymap + ‘.longitude’] = res.longitude;

        changeData[‘paramsMap.key’] = 0;     

        that.setData(changeData);

        typeof that.afterChooseLocation == “function” && that.afterChooseLocation();

      },

      fail: function (res) {

        if (res.errMsg == “chooseLocation:fail auth deny”) {

          wx.showModal({

            title: ‘提示’,

            content: ‘该功能需要定位权限’,

            success: function (res) {

              if (res.confirm) {

                wx.openSetting();

              }

            }

          })

        }

      }

    })

  },

  afterChooseLocation:function(){

    console.log(111);

    wx.navigateTo({

      url: ‘bus_line_list’

    })

  }

开发工具执行navigateTo方法失败,手机可以

回到顶部