vue+elementUi 實(shí)現(xiàn)密碼顯示/隱藏+小圖標(biāo)變化功能
vue+elementUi 實(shí)現(xiàn)密碼顯示/隱藏+小圖標(biāo)變化(js一共三行代碼,其中一行為了美觀)...,先給大家展示下效果圖,感覺不錯可以參考實(shí)現(xiàn)代碼。
【效果圖】
【html】
// 前后代碼【略】 <el-form-item label="密碼" prop="pwd"> <el-input v-model="ruleForm.pwd" :type="pwdType" placeholder="請輸入密碼" @keyup.enter.native="login"> <i slot="suffix" class="el-icon-view" @click="showPwd"></i> </el-input> </el-form-item>
【js】
showPwd () { this.pwdType === 'password' ? this.pwdType = '' : this.pwdType = 'password'; let e = document.getElementsByClassName('el-icon-view')[0]; this.pwdType == '' ? e.setAttribute('style', 'color: #409EFF') : e.setAttribute('style', 'color: #c0c4cc'); },
ps:下面看下vue+element-ui實(shí)現(xiàn)顯示隱藏密碼
<template> <el-form :model="cuser_info" label-width="115px" label-position="left" > <el-row :gutter="20"> <el-col :span="24"> <el-form-item v-if="visible2" label="確認(rèn)密碼" prop="confirm_pwd"> <el-input type="password" v-model="cuser_info.confirm_pwd" placeholder="請再次輸入密碼"> <i slot="suffix" title="顯示密碼" @click="changePass('show',2)" style="cursor:pointer;" class="iconfont icon-xianshizy"></i> </el-input> </el-form-item> <el-form-item v-else label="確認(rèn)密碼" class="is-required" prop="confirm_pwd"> <el-input type="text" v-model="cuser_info.confirm_pwd" placeholder="請再次輸入密碼"> <i slot="suffix" title="隱藏密碼" @click="changePass('hide',2)" style="cursor:pointer;" class="iconfont icon-yincangby"></i> </el-input> </el-form-item> </el-col> </el-form> </template> <script> export default { name: "AddC_user", data(){ return{ cuser_info:{ confirm_pwd:'', }, visible2: true, } }, methods:{ //控制密碼顯示隱藏 changePass(value,kind) { this.visible2 = !(value === 'show'); }, }, } </script>
總結(jié)
以上所述是小編給大家介紹的vue+elementUi 實(shí)現(xiàn)密碼顯示/隱藏+小圖標(biāo)變化功能,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
如果你覺得本文對你有幫助,歡迎轉(zhuǎn)載,煩請注明出處,謝謝!
相關(guān)文章
Vue3結(jié)合TypeScript項目開發(fā)實(shí)踐總結(jié)
本文主要介紹了Vue3結(jié)合TypeScript項目開發(fā)實(shí)踐總結(jié),文中通過示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下2021-09-09淺談vue3中effect與computed的親密關(guān)系
這篇文章主要介紹了淺談vue3中effect與computed的親密關(guān)系,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-10-10解決vue.js this.$router.push無效的問題
今天小編就為大家分享一篇解決vue.js this.$router.push無效的問題,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-09-09關(guān)于vue v-for 循環(huán)問題(一行顯示四個,每一行的最右邊那個計算屬性)
這篇文章主要介紹了關(guān)于vue v-for 循環(huán)問題(一行顯示四個,每一行的最右邊那個計算屬性),需要的朋友可以參考下2018-09-09在vue和element-ui的table中實(shí)現(xiàn)分頁復(fù)選功能
這篇文章主要介紹了在vue和element-ui的table中實(shí)現(xiàn)分頁復(fù)選功能,本文代碼結(jié)合圖文的形式給大家介紹的非常詳細(xì),具有一定的參考借鑒價值,需要的朋友可以參考下2019-12-12vue router中mode history、base的作用說明
這篇文章主要介紹了vue router中mode history、base的作用說明,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-05-05Vue3中如何使用v-model高級用法參數(shù)綁定傳值
本文給大家介紹Vue3中使用v-model高級用法參數(shù)綁定傳值的相關(guān)知識,包括單個輸入框傳值和多個輸入框傳值,一個組件接受多個v-model值,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),需要的朋友參考下吧2023-10-10