The field input box of Vant in Vue realizes the visible password of the input content, and the password switches small eyes

Reference: https://blog.csdn.net/lllomh/article/details/116007154

<van-field
	 v-model="password"
	 :type="passwordType"
	 name="密码"
	 label="密码"
	 placeholder="密码"
	 :rules="[{ required: true, message: '请填写密码' }]">
	<template slot="right-icon">
	      <span class="solts" @click="switchPasswordType">
	           <van-icon name="eye" v-if="passwordType==='password'"/>
	           <van-icon name="closed-eye" v-else />
	      </span>
	</template>
</van-field>
switchPasswordType() {
    
    
  this.passwordType = this.passwordType === 'password' ? 'text' : 'password'
},

Guess you like

Origin blog.csdn.net/qq_46302247/article/details/128675790