微信小程序 检查接口状态实例详解
微信小程序检查接口状态实例详解
实例代码:
//检查接口是否可用 wx.getSetting({ success(res){ if(!res['scope.record']){ //接口调用询问 wx.authorize({ scope:'scope.userInfo', success(res){ wx.startRecord()//用户已经同意小程序使用录音功能,后续调用wx.startRecord接口不会弹窗询问 }, fail(){}, complete(){} }) } } }) scope:'scope.userInfo',//用户信息wx.getUserInfo scope:'scope.userLocation',//地理位置wx.getLocation,wx.chooseLocation scope:'scope.address',//通讯地址wx.chooseAddress scope:'scope.record',//录音功能wx.startRecord scope:'scope.writePhotosAlbum'//保存到相册wx.saveImageToPhotosAlbum,wx.saveVideoToPhotosAlbum
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!