微信小程序-input密码可见与不可见
发表时间:2021-2-28
发布人:葵宇科技
浏览次数:116
wxml
<view class="form_section">
<view class="form_section_title">密码</view>
<view class="form_section_cell">
<input class="weui-input" name="input" password='{{isPassword}}' bindinput="passwordInput" type="text" placeholder="请输入登录密码" placeholder-style="color: #BFC6CB;" />
<image wx:if="{{isShowImg}}" class='showImg' bindtap='showPassword' src="http://www.wxapp-union.com/{{isPassword ?'img/common_btn_unlook.png' : 'img/common_btn_look.png' }}"></image>
</view>
</view>
js
data: { password:"", isShowImg: false, isPassword: true, canIUse: wx.canIUse('button.open-type.getUserInfo') }, passwordInput: function (e) { let password = e.detail.value this.setData({ password, isShowImg:true }) },