有時候會有這種需求,密碼輸入的時候點擊要顯示密碼再次點擊隱藏。
demo 請狠狠的戳這里 ¥ https://download.lllomh.com/cliect/#/product/F422705952730242
接下來,就實現這個做個記錄
vant 官方文檔中Filed密碼框沒有右側👀功能的,要自己加上!
先看代碼:
利用 插槽 slot 插入右側圖標
switchPasswordType 方法改變 passwordType 的值即可
組件用法代碼:
效果如圖: