1.input组件的password设置为动态前面加:冒号;
2.动态切换眼睛图标使用:style
javascript
//html
<view>
密码:<input placeholder="请输入密码" :password="openPassword" type="text" placeholder-style="color:#e2e2e2;" maxlength="20" @input="getPassword" />
<img :src="openPassword?'./../../static/images/passwordshow.png':'./../../static/images/passwordfalse.png'" @tap="isShowPassword">
</view>
//data
openPassword: true, // 眼睛/密码隐藏显示
//js
// 密码隐藏显示
isShowPassword () {
this.openPassword = !this.openPassword;
},
上一篇文章,