Home > Web Front-end > JS Tutorial > How to implement password display and hide switching function in vue

How to implement password display and hide switching function in vue

亚连
Release: 2018-06-05 11:17:53
Original
2730 people have browsed it

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>
Copy after login

script:

data () {

 return {

  registration_data:{

   pwdType:"password",
   src:require("../assets/colse_eyes.png")
  }
 }
},
methods:{
changeType(){
 this.registration_data.pwdType = this.registration_data.pwdType===&#39;password&#39;?&#39;text&#39;:&#39;password&#39;;
 this.registration_data.src=this.registration_data.src==require("../assets/colse_eyes.png")?require("../assets/open_eyes.png"):require("../assets/colse_eyes.png");
}
}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template