This article mainly introduces the password display and hide switching function implemented by vue. Friends who need it can refer to it
Let me share the renderings with you first:
The specific implementation code is as follows:
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"); } }
The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.
Related articles:
How to use parent components to call child component events in Vue
How to implement the data-driven view principle through vuejs
Use $http to implement asynchronous uploading of Excel files in angularjs
The above is the detailed content of How to implement password display and hide switching function in vue. For more information, please follow other related articles on the PHP Chinese website!