getUserInfo() {
return new Promise((resolve, reject) => {
wx.getUserInfo({
withCredentials: true,
success: function (res) {
var userInfo = res.userInfo
var nickName = userInfo.nickName
var avatarUrl = userInfo.avatarUrl
var gender = userInfo.gender //性别 0:未知、1:男、2:女
var province = userInfo.province
var city = userInfo.city
var country = userInfo.country
resolve(userInfo);
},
fail:function(res){
console.log(“需要授权”);
let button = wx.createUserInfoButton({
type: ‘text’,
text: ‘获取用户信息’,
style: {
left: 10,
top: 76,
width: 200,
height: 40,
lineHeight: 40,
backgroundColor: ‘#ff0000’,
color: ‘#ffffff’,
textAlign: ‘center’,
fontSize: 16,
borderRadius: 4
}
})
button.onTap((res)=> {
console.log(res)
})
}
})
})
}
更新完新版本后,不显示授权按键了。。。。。。。。
你好,请提供一下出现问题的机型和微信版本,以及能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。