定位 用户拒绝获取定位后有没有什么方法调起来?
发布于 3 年前 作者 taoqin 4903 次浏览 来自 问答

定位 用户拒绝获取定位后有没有什么方法调起来?

定位 用户拒绝获取定位后有没有什么方法调起来?

定位 用户拒绝获取定位后有没有什么方法调起来?

uni.getLocation()

2 回复

  gohome() {

    // map是id

    var that=this

    const mpCtx = wx.createMapContext("map");

    wx.getSetting({

      success(res) {

        if (!res.authSetting['scope.userLocation']) {

          wx.authorize({

            scope: 'scope.userLocation',

            success () {

              mpCtx.moveToLocation();

              that.getmygcj02()

            },

            fail () {

              wx.openSetting({

                success (res) {

                  mpCtx.moveToLocation();

            //      that.getmygcj02()

                }

              })

            },

          })

        }

        else

        { mpCtx.moveToLocation();

   //       that.getmygcj02()}

      }

    })

试试看吧,我的源码

使用 wx.openSetting打开设置页,手动选择打开。

回到顶部