html
这个是通过一个点击事件进行显示的,下面是效果图,获取头像最关键的是 open-type="chooseAvatar" ,获取昵称最关键的是 type="nickname" ,大家多加注意i哦
<!-- 大的输入调取 -->
<view class="myis_box" wx:if="{{showMyisBox}}" >
<!-- 头像 -->
<view class="myicon_box" style="position: relative;">
<image src="{{avatarUrl || 'http://lzh.yzwdblzs.xyz/wjqyimg/8393e56638c82f5f4c3662f215f9089b.png'}}" class="myicon" />
<button style="position: absolute; width: 60px; height: 60px; opacity: 0;" open-type="chooseAvatar" bindchooseavatar="chooseavatar">测试</button>
</view>
<!-- 昵称 -->
<view class="myname">
<view style="margin-right: 30px;">昵称</view>
<input type="nickname" class="weui-input" name="nickname" placeholder="请输入昵称"/>
</view>
<!-- 点击提交 -->
<button style="background-color: #07c160;color: white; width: 80%;margin-left: 10%;position: fixed;bottom: 20px;" bind:tap="submits">提交</button>
</view>
js
// 回显图片
chooseavatar(e) {
this.setData({
avatarUrl: e.detail.avatarUrl
});
}