自2022年11月8日后, 微信回收获取用户头像、昵称api接口 相关公告
解决方案一、 如有必要场景需收集用户头像昵称,可在个人中心或设置等页面让用户完善个人资料
解决方案二(官方) 头像昵称填写
使用方法 头像选择与昵称填写 需要将 button 组件 open-type 的值设置为 chooseAvatar,当用户选择需要使用的头像之后,可以通过 bindchooseavatar 事件回调获取到获取到头像信息的临时路径。
<button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
<image class="avatar" :src="avatarUrl"></image>
</button>
<input type="nickname" class="weui-input" placeholder="请输入昵称" />
data() {
return {
avatarUrl: 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0',
}
},
methods: {
onChooseAvatar(e) {
this.avatarUrl = e.detail.avatarUrl
},
}