- 点击没有反应,不能执行handleUserProfile1 函数
handleUserProfile1(e) { console.log('当前基础库版本:', wx.getSystemInfoSync().SDKVersion); console.log(e) if (e.detail.errMsg.includes('deny')) { wx.showModal({ title: '提示', content: '需要授权才能继续操作', success: (res) => { if (res.confirm) wx.openSetting() } }) } else if (e.detail.errMsg === 'getUserProfile:ok') { const { avatarUrl, nickName } = e.detail.userInfo this.setData({ avatar: avatarUrl }) // 更新头像显示 } else { console.error('授权失败:', e.detail.errMsg) } }, <button class="username" open-type="getUserProfile" bind:getuserprofile="handleUserProfile1" type="default" >获取信息</button>
03-24 - 点击 没有反应,函数没有执行
https://developers.weixin.qq.com/miniprogram/dev/framework/ <button class="username" open-type="getUserProfile" bind:getuserprofile="handleUserProfile1" type="default" >获取信息</button> handleUserProfile1(e) { console.log('当前基础库版本:', wx.getSystemInfoSync().SDKVersion); console.log(e) if (e.detail.errMsg.includes('deny')) { wx.showModal({ title: '提示', content: '需要授权才能继续操作', success: (res) => { if (res.confirm) wx.openSetting() } }) } else if (e.detail.errMsg === 'getUserProfile:ok') { const { avatarUrl, nickName } = e.detail.userInfo this.setData({ avatar: avatarUrl }) // 更新头像显示 } else { console.error('授权失败:', e.detail.errMsg) } },
03-24