Xml页面:
<view class="userinfo">
<open-data type="userAvatarUrl" class="img" ></open-data>
<image class="userinfo-avatar" ></image>
</view>
css页面:
.userinfo {
margin-left: 48rpx;
margin-top: 48rpx;
width: 120rpx;
height: 120rpx;
background: rgba(42, 192, 206, 1);
display: flex;
flex-direction: column;
align-items: center;
border-radius: 60rpx;
}
.userinfo-avatar {
width: 128rpx;
height: 128rpx;
margin: 20rpx;
border-radius: 50%;
}
.img{
width: 120rpx;
height: 120rpx;
}
Js页面:
data: {
navHeight: app.globalData.statusBarHeight * 2 + 86,
nowUserId: app.globalData.userId,
canIUse: wx.canIUse('button.open-type.getUserInfo'),
hasUserInfo: false,
},