<li>
    <span class="icon password-icon">新密码:</span>
    <input  :type="pwdType" placeholder="请输入新密码" @on-change="userPassword" maxlength="18" v-model="userPassword" @blur="getUserPassword">
    <img :src="seen?openeye:nopeneye" class="eye" alt="" @click="changeType()">
    <span class="from-box-line"></span>
  </li>

data里面:

seen:'',
pwdType: 'password', // 密码类型
openeye: require('@/assets/eye.png'), //图片地址
nopeneye: require('@/assets/neye.png'), //图片地址
userPassword:'',

methods里面:

      changeType() {
        this.pwdType = this.pwdType === 'password' ? 'text' : 'password';
        this.seen = !this.seen;//小眼睛的变化
      },

 

Logo

前往低代码交流专区

更多推荐