先给大家分享效果图:
具体实现代码如下所示:
html:
复制代码
1
2
3
4
5<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:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17data () { 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"); } }
注:带小眼睛的睁开闭合。
总结
以上所述是小编给大家介绍的vue实现密码显示隐藏切换功能,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!
最后
以上就是微笑眼神最近收集整理的关于vue实现密码显示隐藏切换功能的全部内容,更多相关vue实现密码显示隐藏切换功能内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复