微信小程序中获取用户权限授权情况 wx.getSetting 的 success 回调结果很奇怪:

wx.getSetting({success: function(e) {console.log(e.authSetting)}})

因为我之前已经授权了地理位置的获取权限,所以结果是

{scope.userLocation: true}

但是这种键的方式我是第一次看到,通过

console.log(e.authSetting.scope.userLocation)

这样是取不到值的,因为键是个字符串,所以可以通过数组的方式取:

e.authSetting["scope.userLocation"]

TAG标签: 微信小程序setting

http://www.xiaochengxub.com/read-103633.html