问题模块 |
---|
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');
}
}
});