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");
}
}
注:带小眼睛的睁开闭合。
 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM