获取用户地址的时候用户点击取消怎么办?
发布于 4 年前 作者 tao94 10607 次浏览 来自 官方Issues

wx.getLocation(Object object)

获取用户地址的时候,如果用户点击取消没有一点返回值,怎么判断用户点击的取消呢?因为用户点击取消需要做不同的处理

2 回复

ailfunction否接口调用失败的回调函数

completefunction否接口调用结束的回调函数(调用成功、失败都会执行)

https://developers.weixin.qq.com/miniprogram/dev/api/open-api/authorize/wx.authorize.html

// 可以通过 wx.getSetting 先查询一下用户是否授权了 "scope.record" 这个 scopewx.getSetting({
  success(res) {
    if (!res.authSetting['scope.record']) {
      wx.authorize({
        scope: 'scope.record',
        success () {
          // 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
          wx.startRecord()
        }
      })
    }
  }})
回到顶部