自制小程式密碼輸入框顯示隱藏
html
<view class="weui-cell"> <view class="weui-cell__bd"> <input password='{{isShowPassword}}' placeholder="新密碼,至少6位英文數字結合" placeholder-class='placeholder_class'/> </view> <view class="weui-cell__ft get_qrcode" bindtap='toggleShowPassword'> <image src='../images/eye.png' wx:if='{{isShowPassword}}'/> <image src='../images/closeeye.png' wx:if='{{!isShowPassword}}'/> </view> </view>
js
data: {
isShowPassword: true
},
/**
* 生命週期函式--監聽頁面載入
*/
onLoad: function (options) {
},
toggleShowPassword: function (e) {
var isShowPassword = !this.data.isShowPassword;
this.setData({
isShowPassword: isShowPassword
});
},