这篇文章主要介绍了vue实现密码显示隐藏切换功能,需要的朋友可以参考下
先给大家分享效果图:


具体实现代码如下所示:
html:
<group> <span>设置密码</span> <x-input :type="this.registration_data.pwdType" placeholder="请填写密码" @on-change="password"></x-input> <img :src="this.registration_data.src" @click="changeType()"/> </group>
script:
立即学习“前端免费学习笔记(深入)”;
data () {
return {
registration_data:{
pwdType:"password",
src:require("../assets/colse_eyes.png")
}
}
},
methods:{
changeType(){
this.registration_data.pwdType = this.registration_data.pwdType==='password'?'text':'password';
this.registration_data.src=this.registration_data.src==require("../assets/colse_eyes.png")?require("../assets/open_eyes.png"):require("../assets/colse_eyes.png");
}
}上面是我整理给大家的,希望今后会对大家有帮助。
相关文章:
在angularjs中使用$http实现异步上传Excel文件方法
以上就是在vue中如何实现密码显示隐藏切换功能的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号