onLoad() {
setTimeout(() => {
console.log("-------setTimeout-----")
wx.getUserProfile({
desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: res => {
console.log("--------getUserProfile------",res)
}
})
}, 3000);
}
}
getUserProfile 无法在setTimeout调用吗?是我的方法写错了么?Can't getUserProfile be called at setTimeout? Is my method wrong?
getUserProfile 无法在setTimeout调用吗?是我的方法写错了么?onLoad() {
setTimeout(() => {
console.log("-------setTimeout-----")
wx.getUserProfile({
desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: res => {
console.log("--------getUserProfile------",res)
}
})
}, 3000);
}
}
Onload() {setTimeout (() = > {console.log ("-------- setTimeout ----") wx.getuserprofile ({desc: 'display user information', / / declare the purpose of obtaining the user's personal information, which will be displayed in the pop-up window later. Please fill in success: res = > {console.log ("-------- getuserprofile ----", RES)})}, 3000);}}
回答:
https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserProfile.html
在点击方法后才能调用
得用点击事件触发,你写错了