欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

基于vue 實現(xiàn)表單中password輸入的顯示與隱藏功能

 更新時間:2019年07月19日 16:47:54   作者:rachelch  
這篇文章主要介紹了vue 實現(xiàn)表單中password輸入的顯示與隱藏功能 ,本文給大家介紹的非常詳細,具有一定的參考借鑒價值,需要的朋友可以參考下

實現(xiàn)效果:

點擊 “眼睛” 的時候顯示與隱藏

代碼:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <link href="css/bootstrap.min.css" rel="external nofollow" rel="stylesheet">
  <script src="js/vue.js"></script>
  <title>Title</title>
  <style>
    #main{
      text-align: center;
      margin-top:60px;
    }
    input[type=text],input[type=password]{
      width:260px;
      height:28px;
      display: inline-block;
    }
    span{
      margin-left:-30px;
      cursor: pointer;
    }
    input[type=checkbox]{
      cursor: pointer;
      opacity: 0;
      margin-left:-18px;
      display: inline-block;
    }
  </style>
</head>
<body>
<div id="main">
    <input type="text" class="form-control" v-model="msg" v-if="checked">
    <input type="password" class="form-control" v-model="msg" v-else>
    <span class="glyphicon glyphicon-eye-open"></span>
    <input type="checkbox"  v-model="checked">
</div>
<script>
  new Vue({
    el:"#main",
    data:{
      msg:"",
      checked:false
    },
    methods:{
    }
  });
</script>
  <script src="js/jquery.min.js"></script>
  <script src="js/bootstrap.min.js"></script>
</body>
</html>

=====================================

登錄頁面input輸入密碼顯示與隱藏實現(xiàn):

效果(點擊顯示與隱藏進行切換):

代碼:

<!doctype html>
<html>
  <head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <script src="js/vue.js"></script>
    <script src="js/vue-resource.js"></script>
    <style>
      body{
        background:white;
      }
      .main{
        padding-top:50px;width:95%;margin:0 auto;
      }
      .account{
        border-bottom:1px solid #dfdfdf;padding-top:28px;
      }
      .account input{
        border:none;font-size:14px;margin-bottom:5px;width:91.5%;height:44px;
      }
      .account i{
        width:14px;
        height:14px;
        line-height:14px;
        font-size:18px;
        display:inline-block;
        color:white;
        background:#cdcdcd;
        border-radius:50%;
        text-align:center;
        font-style:normal;
      }
      .account .psd{
        width:81.6%;
      }
      .account span{
        color:#bfbfbf;float:right;line-height:40px;
      }
    </style>
  </head>

  <body>
    <div id="login">
      <div class="main">
        <div class="account">
          <input type="password" placeholder="密碼" class="psd" v-model="psd" v-if="ifDisplay"/>
          <input type="text" placeholder="密碼" class="psd" v-model="psd" v-else/>
          <i v-show="psd" @click="clearPassword()">×</i>
          <span v-show="ifDisplay" @click="ifDisplay=!ifDisplay">隱藏</span>
          <span v-show="!ifDisplay" @click="ifDisplay=!ifDisplay">顯示</span>
        </div>
      </div>
    </div>
    <script type="text/javascript">
      var vm=new Vue({
        el:'#login',
        data:{
          username:'',
          psd:'',
          ifDisplay:false,
        },
        methods:{
          clearPassword:function(){
            this.psd='';
          },
        }
      })
    </script>
  </body>
</html>

總結(jié)

以上所述是小編給大家介紹的基于vue 實現(xiàn)表單中password輸入的顯示與隱藏功能,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
如果你覺得本文對你有幫助,歡迎轉(zhuǎn)載,煩請注明出處,謝謝!

相關(guān)文章

  • 理理Vue細節(jié)(推薦)

    理理Vue細節(jié)(推薦)

    這篇文章主要介紹了Vue細節(jié),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2019-04-04
  • Vue2中配置Cesium全過程

    Vue2中配置Cesium全過程

    這篇文章主要介紹了Vue2中配置Cesium全過程,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2023-05-05
  • Vue實現(xiàn)輪播圖組件的封裝

    Vue實現(xiàn)輪播圖組件的封裝

    Vue輪播圖組件的封裝可通過封裝組件、使用插件、配置化等方式實現(xiàn),主要包括圖片預加載、定時輪播、無限滾動、手勢滑動、響應式布局等功能,實現(xiàn)方式可使用Vue的生命周期函數(shù)、自定義事件、計算屬性等技術(shù)
    2023-04-04
  • 深入理解vue-class-component源碼閱讀

    深入理解vue-class-component源碼閱讀

    這篇文章主要介紹了深入理解vue-class-component源碼閱讀,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2019-02-02
  • 一起寫一個即插即用的Vue Loading插件實現(xiàn)

    一起寫一個即插即用的Vue Loading插件實現(xiàn)

    這篇文章主要介紹了一起寫一個即插即用的Vue Loading插件實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2019-10-10
  • 在vue中路由使用this.$router.go(-1)返回兩次問題

    在vue中路由使用this.$router.go(-1)返回兩次問題

    這篇文章主要介紹了在vue中路由使用this.$router.go(-1)返回兩次問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2023-12-12
  • 在Vue中進行數(shù)據(jù)分頁的實現(xiàn)方法

    在Vue中進行數(shù)據(jù)分頁的實現(xiàn)方法

    在前端開發(fā)中,數(shù)據(jù)分頁是一個常見的需求,特別是當處理大量數(shù)據(jù)時,Vue作為一款流行的JavaScript框架,提供了強大的工具和生態(tài)系統(tǒng)來實現(xiàn)數(shù)據(jù)分頁,本文將介紹如何在Vue中進行數(shù)據(jù)分頁,以及如何設(shè)計一個通用的分頁組件,需要的朋友可以參考下
    2023-10-10
  • 使用vscode添加vue模板步驟示例

    使用vscode添加vue模板步驟示例

    這篇文章主要為大家介紹了vscode添加vue模板步驟示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪
    2022-08-08
  • vue中計算屬性computed和普通屬性method的區(qū)別小結(jié)

    vue中計算屬性computed和普通屬性method的區(qū)別小結(jié)

    Vue.js中Computed和Methods是兩種常用的數(shù)據(jù)處理方式,本文主要介紹了vue中計算屬性computed和普通屬性method的區(qū)別小結(jié),具有一定的參考價值,感興趣的可以了解一下
    2024-06-06
  • vue如何使用AIlabel標注組件

    vue如何使用AIlabel標注組件

    這篇文章主要介紹了vue如何使用AIlabel標注組件,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-04-04

最新評論