uniapp获取微信头像和昵称

水深无声 2022-12-05 13:52 724阅读 0赞

在这里插入图片描述

  1. <view class="userInformation">
  2. <!-- 用户自定义头像 -->
  3. <view class="userPortrait">
  4. <image :src="yonghuwx.avatarUrl" mode="widthFix"></image>
  5. </view>
  6. <view class="userLook" >
  7. <!-- 用户自定义名字 -->
  8. <view class="user-title clamp">{ { yonghuwx.nickName}}</view>
  9. <view class="user-edit">查看个人资料</view>
  10. </view>
  11. </view>
  12. yonghuwx:[]
  13. onLoad(){
  14. let that = this;
  15. uni.login({
  16. provider:'weixin',
  17. success:function(loginRes) {
  18. // 获取用户信息
  19. uni.getUserInfo({
  20. provider:'weixin',
  21. success:function(infoRes){
  22. that.yonghuwx = infoRes.userInfo
  23. console.log(that.yonghuwx)
  24. }
  25. });
  26. }
  27. });
  28. }

发表评论

表情:
评论列表 (有 0 条评论,724人围观)

还没有评论,来说两句吧...

相关阅读