先给大家分享效果图:
具体实现代码如下所示:
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中如何使用父组件调用子组件事件
通过vuejs如何实现数据驱动视图原理
在angularjs中使用$http实现异步上传excel文件方法
以上就是在vue中如何实现密码显示隐藏切换功能的详细内容。
