默认密码隐藏起来(显示为点),后面的图标是闭眼;用户点击图标后,图标变成睁眼,同时把密码明文显示出来;如此循环
javascript
Page({
data: {
passwordType: true, // 切换是否密码框
show_pass: false // 是否显示密码
}
})
html
<text class="page-flex-password">设置密码</text>
<view class="page-flex-row3">
<input name="password" class="page-input2" placeholder-class="place-holder" placeholder="请输入您要设置的密码(6-12位)" password="{{passwordType}}"></input>
<image class="password-icon" src="../../images/register/xianshi.png" bindtap="seeTap" wx:if="{{show_pass}}"/>
<image class="password1-icon" src="../../images/register/yincnang.png" bindtap="seeTap" wx:else/>
</view>
用户点击图标时:
javascript
seeTap:function(){
var that = this
that.setData({
show_pass:!that.data.show_pass, // 切换图标
passwordType:!passwordType, // 切换是否密码框
})
},