canIUse是false,但会执行success方法代码
发布于 6 年前 作者 pengxiuying 2525 次浏览 来自 问答

// 代码

 1   wx.getSystemInfo({
 2     success(res) {
 3       console.log(res)
 4     }
 5   })
 6   console.log(wx.canIUse("getSetting.success"), wx.canIUse("authorize.success"))
 7   wx.getSetting({
 8     success(res) {
 9       if (!res.authSetting['scope.writePhotosAlbum']) {
 10         wx.authorize({
 11           scope: 'scope.writePhotosAlbum',
 12          success() {
 13             console.log('success')
 14           }
 15         })
 16       }
 17     }
 18   })

// log信息

// 代码行1

  1. SDKVersion:"1.7.1"

  2. batteryLevel:100

  3. brand:"devtools"

  4. errMsg:"getSystemInfo:ok"

  5. fontSizeSetting:16

  6. language:"zh_CN"

  7. model:"iPhone 6"

  8. pixelRatio:2

  9. platform:"devtools"

  10. screenHeight:667

  11. screenWidth:375

  12. system:"iOS 10.0.1"

  13. version:"6.6.3"

  14. windowHeight:603

  15. windowWidth:375

true false //代码行6

success //代码行13

canIUse是false,但是可以授权成功

回到顶部