element 密码显示 隐藏
element 密码显示 隐藏
点击密码显示隐藏切换,验证密码是否正确
主要使用elment 组件实现
通过改变 type 类型实现
type = password 密码隐藏
type = " " 为空时 密码显示为输入内容
html
export default{
data(){
pwdType:"password"
}
methods:{
showPwd() {
this.pwdType === "password" ? (this.pwdType = "") : (this.pwdType = "password");
let e = document.getElementsByClassName("el-icon-view")[0];
this.pwdType == ""? e.setAttribute("style", "color: #c0c4cc") : e.setAttribute("style", "color: #409EFF");
},
}
}