点击获取微信昵称、头像

<button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
<image class="avatar" :src="avatarUrl"></image>
</button>
<input type="nickname" class="weui-input" @change="getNickname" placeholder="请输入昵称" />

 

 

 

getNickname(e) {
console.log("getNickname", e.detail.value)

},
onChooseAvatar(e) {
console.log(e, '头像昵称')
const {
avatarUrl
} = e.detail
this.avatarUrl = avatarUrl
},

 

 

 

参考文档:https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/userProfile.html

 

posted @   巳蛇  阅读(66)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
点击右上角即可分享
微信分享提示