mini-program-login-userinfo

wx.getUserInfo

这个接口字面意思很简单,就是取得用户的信息,目前最新版本的接口,已经不会弹出对话框,要用户来授权。所以一般此接口单独使用,毫无效果,示例如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//app.js
App({
onLaunch: function () {
console.log('App before call wx.getSetting')
wx.getUserInfo({
success: res => {
console.log('success', res)
},
fail: res => {
console.log('fail', res)
},
complete: res => {
console.log('complete', res)
}
})
}
})

结果如下

1
2
3
App before call wx.getSetting
fail {errMsg: "getUserInfo:fail auth deny"}
complete {errMsg: "getUserInfo:fail auth deny"}