html52.com
我爱小程序-开发者交流社区

官方文档api例子错误

问题模块
API和组件
// 可以通过 wx.getSetting 先查询一下用户是否授权了 "scope.record" 这个 scopewx.getSetting({

   success(res) {        

        if (!res['scope.record']) {

           wx.authorize({                scope: 'scope.record',                success() {                    // 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问                    wx.startRecord()                }            })        }    } })

以上代码运行错误,res['scope.record'] undefined


正确运行代码:

wx.getSetting({

      success(res) {

        console.log(res);

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

          gd.auths();

        } else {

          util.toPage('../chat/chat');

        }

      }

    });



评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付