获取用户信息
将index.wxml中代码改为
<view class="indexContainer">
<image wx:if="{{userInfo.avatarUrl}}" class="atarUrl" src="{{UserInfo.avatarUrl}}"></image>
<button wx:else bindtap="getUserInfo">获取用户信息</button>
<text class="userName" catchtap="name_change">{{UserInfo.nickname}}</text>
<!-- <view class="goStudy" bindtap="handleParent">
<text bindtap='handleChild'>hello world</text>
</view>
</view>-->
<view class="goStudy" bindtap="toLog">
<text>hello world</text>
</view>
</view>
在bottom中从原来的
<button bindgetuserinfo="handleGetUserInfo" open-type="getUserInfo">获取用户信息</button>
改为
<button wx:else bindtap="getUserInfo">获取用户信息</button>
而在index.js中
在page代码后输入代码
最后得到结果