调用位置API,wx.chooseLocation为什么调试的时候可以用,但是真机按了没反应?
发布于 7 年前 作者 yzeng 6882 次浏览 来自 问答

wx.chooseLocation、wx.getLocation这两个,然后关联两个按钮,为什么调试的时候可以用,但是真机按了没反应?

chooseloc:function(temp)

  {

  let that=this

    wx.chooseLocation({

    success: function(res) {

console.log(res)

            that.setData({

              choosen:res,

            })

        },

      })

  },


  gotloc: function (temp) {

    let that = this

    wx.getLocation({

      success: function (res) {

        console.log(res)

        that.setData({

          got: res,

          flag2: true

        })

      },

    })

  },

t

调试电脑端:

真机端这两个按钮死活没用

2 回复

代码亮出来,这不就对了。https://developers.weixin.qq.com/community/develop/doc/000e2eecb0cc001402998a0ad59400

调试下看看是不是走fail回调了

提示一下手机的、微信的、小程序的、依次位置授权是否正常。

回到顶部