先给大家分享效果图:
具体实现代码如下所示:
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\"); } }
注:带小眼睛的睁开闭合。
以上所述是小编给大家介绍的vue实现密码显示隐藏切换功能,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!
© 版权声明
THE END
暂无评论内容