微信小程序判断手机有没有定位的方法
展开阅读全文

微信小程序判断手机有没有定位的方法

var that = this;
      wx.getSystemInfo({
        success(res) {
          var isopendingwei = res.locationEnabled;
          if (isopendingwei == false) {
            wx.showModal({
              title: '温馨提示:',
              content: '请先开启手机GPS定位,然后重新刷新',
              showCancel: false,
              confirmText: '关闭提示',
              success(res) {

              }
            })
          } else {
            wx.openSetting({
              success(res) {
                console.log(res.authSetting)
              }
            })
          }
        }
      })