【效果图】

图片描述
图片描述
图片描述

【html】

// 前后代码【略】
<el-form-item label="密码" prop="pwd">
  <el-input v-model="ruleForm.pwd" :type="pwdType" placeholder="请输入密码" @keyup.enter.native="login">
    <i slot="suffix" class="el-icon-view" @click="showPwd"></i>
  </el-input>
</el-form-item>

【js】

showPwd () {
  this.pwdType === 'password' ? this.pwdType = '' : this.pwdType = 'password';
  let e = document.getElementsByClassName('el-icon-view')[0];
  this.pwdType == '' ? e.setAttribute('style', 'color: #409EFF') : e.setAttribute('style', 'color: #c0c4cc');
},
Logo

前往低代码交流专区

更多推荐