<template>
  <el-input :type="isShowPwd ? 'text' : 'password'" v-model="password" suffix-icon="el-icon-view" @click:suffix="togglePwd"></el-input>
</template>
<script>
export default {
  data() {
    return {
      password: '',
      isShowPwd: false
    }
  },
  methods: {
    togglePwd() {
      this.isShowPwd = !this.isShowPwd;
    }
  }
}
</script>
Vue + Element UI 密码输入框:实现眼睛图标切换明文密文

原文地址: https://www.cveoy.top/t/topic/nPcs 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录