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