最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

vue 驗證碼界面實現(xiàn)點擊后標灰并設(shè)置div按鈕不可點擊狀態(tài)

 更新時間:2019年10月28日 09:54:44   作者:haeasringnar  
今天小編就為大家分享一篇vue 驗證碼界面實現(xiàn)點擊后標灰并設(shè)置div按鈕不可點擊狀態(tài),具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧

1、先看看效果圖

未點擊獲取驗證碼的按鈕狀態(tài)

點擊后的不可點擊狀態(tài)

2、代碼實現(xiàn)

<template>
 <div class="my-code">
   <input class="my-code-input" type="text" v-model="login_form.captcha" placeholder="Your Captcha">
   <div class="my-code-get" @click="get_captcha" id="new_yan">
     <span v-show="show">Get Captcha</span>
     <span v-show="!show">{{ count }} s</span>
   </div>
 </div>
</template>

<script>
  import store from '@/store'
  import Vue from 'vue'
  import $ from 'jquery'

  export default {
    name: "register",
    data () {
      return {
        show: true,
        count: 60,
        timer: null,
      }
    },
    methods: {
      get_captcha() {
         if (this.login_form.username === '' ) {
          alert('Phone number or mailbox cannot be empty')
        } else {
          if(this.timer == null){
            getValidate(this.login_form.username).then(response => {
              const data = response.data
              console.log(data)
              console.log('成功')
            }).catch(error => {
              console.log(error)
              alert(error)
            })
          } 
          if (!this.timer) {
            this.count = 60;
            this.show = false;
            $(".my-code-get").addClass("huise")
            // 將鼠標設(shè)置為不可點擊狀態(tài)
            document.getElementById('new_yan').style.cursor = 'not-allowed'
            this.timer = setInterval(() => {
              if (this.count > 0 && this.count <= 60) {
                this.count--
              } else {
                this.show = true
                clearInterval(this.timer)
                this.timer = null
              }
            }, 1000)
          }
        }
      }
    },
    created: function() {
    },
    watch:{
      timer: function(val){
        console.log(val)
        if(val == null){
           // 監(jiān)聽timer變化,移除不可點擊樣式
          $(".my-code-get").removeClass("huise")
          document.getElementById('new_yan').style.cursor = 'pointer'
        }
      }
    }
  }
</script>

<style scoped>
  .my-input{
    text-align: left;
    display: block;
    width: 400px;
    height: 35px;
    padding: 3px;
    margin: 20px calc(50% - 200px) 20px calc(50% - 200px);
    background:none; 
    outline:none; 
    border:0px;
    border-bottom: 2px solid #dcdcdc;
    border-bottom-left-radius: 1px;
    border-bottom-right-radius: 1px;
    box-sizing: border-box;
    font-family: PingFangSC-Regular;
    font-size: 16px;
  }
  .my-code{
    overflow: hidden;
  }
  .my-code-get{
    float: left;
    width: 120px;
    height: 35px;
    background-color: rgb(7, 187, 127);
    margin: 0 auto 20px 0;
    line-height: 35px;
    font-family: PingFangSC-Regular;
    color: #ffffff;
    border-radius: 5px;
    -webkit-user-select:none;
    -moz-user-select:none;
    -ms-user-select:none;
    user-select:none;
  }
  .my-code-get:active{
    background-color: #0F996B;
  }
  .my-code-get:hover{
    cursor: pointer;
  }
  .my-code-input{
    float: left;
    text-align: left;
    display: block;
    width: 280px;
    height: 35px;
    padding: 3px;
    margin: 0 auto 20px calc(50% - 200px);
    background:none; 
    outline:none; 
    border:0px;
    border-bottom: 2px solid #dcdcdc;
    border-bottom-left-radius: 1px;
    border-bottom-right-radius: 1px;
    box-sizing: border-box;
    font-family: PingFangSC-Regular;
    font-size: 16px;
  }
  .my-code-input:focus{
    border-bottom: 2px solid #0F996B;
    border-bottom-left-radius: 1px;
    border-bottom-right-radius: 1px;
  }
  .huise{
    background-color: #dcdcdc !important;
    color: black;
  }
</style>

以上這篇vue 驗證碼界面實現(xiàn)點擊后標灰并設(shè)置div按鈕不可點擊狀態(tài)就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • Vue.js頁面驗證跳轉(zhuǎn)功能實現(xiàn)

    Vue.js頁面驗證跳轉(zhuǎn)功能實現(xiàn)

    這篇文章主要介紹了Vue.js頁面驗證跳轉(zhuǎn)功能實現(xiàn),本文通過實例代碼給大家介紹的非常詳細,感興趣的朋友跟隨小編一起看看吧
    2024-04-04
  • vue使用iview的modal彈窗嵌套modal出現(xiàn)格式錯誤的解決

    vue使用iview的modal彈窗嵌套modal出現(xiàn)格式錯誤的解決

    這篇文章主要介紹了vue使用iview的modal彈窗嵌套modal出現(xiàn)格式錯誤的解決方案,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-09-09
  • vue實現(xiàn)橫向時間軸

    vue實現(xiàn)橫向時間軸

    這篇文章主要為大家詳細介紹了vue實現(xiàn)橫向時間軸,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2022-02-02
  • vue中利用simplemde實現(xiàn)markdown編輯器(增加圖片上傳功能)

    vue中利用simplemde實現(xiàn)markdown編輯器(增加圖片上傳功能)

    這篇文章主要介紹了vue中利用simplemde實現(xiàn)markdown編輯器(增加圖片上傳功能),本文通過實例代碼相結(jié)合的形式給大家介紹的非常詳細,具有一定的參考借鑒價值,需要的朋友可以參考下
    2019-04-04
  • Vue?h函數(shù)的使用詳解

    Vue?h函數(shù)的使用詳解

    本文主要介紹了Vue?h函數(shù)的使用詳解,文中通過示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2021-12-12
  • webpack vue 項目打包生成的文件,資源文件報404問題的修復方法(總結(jié)篇)

    webpack vue 項目打包生成的文件,資源文件報404問題的修復方法(總結(jié)篇)

    這篇文章主要介紹了解決webpack vue 項目打包生成的文件,資源文件報404問題的修復方法,需要的朋友可以參考下
    2018-01-01
  • Vue集成百度地圖實現(xiàn)位置選擇功能

    Vue集成百度地圖實現(xiàn)位置選擇功能

    由于添加門店時,需要選擇門店的省、市、區(qū)、詳細地址、以及門店的經(jīng)緯度信息,本文給大家分享Vue集成百度地圖實現(xiàn)位置選擇功能,感興趣的朋友一起看看吧
    2022-06-06
  • Vuex之Action的使用方法詳解

    Vuex之Action的使用方法詳解

    這篇文章主要介紹了Vuex之Action的使用方法詳解,Action 類似于 mutation ,不同在于Action 提交的是 mutation,而不是直接變更狀態(tài),
    Action 可以包含任意異步操作,需要的朋友可以參考下
    2023-11-11
  • 基于Vue制作組織架構(gòu)樹組件

    基于Vue制作組織架構(gòu)樹組件

    最近公司在做一個基于vue開發(fā)的項目,項目需要開發(fā)一個展示組織架構(gòu)的樹組件,在網(wǎng)上搜了半天,沒有找到合適的,下面小編給大家分享一個基于Vue制作組織架構(gòu)樹組件,需要的朋友參考下吧
    2017-12-12
  • webpack4+express+mongodb+vue實現(xiàn)增刪改查的示例

    webpack4+express+mongodb+vue實現(xiàn)增刪改查的示例

    這篇文章主要介紹了webpack4+express+mongodb+vue 實現(xiàn)增刪改查的示例,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-11-11

最新評論

盐边县| 天气| 莱阳市| 金门县| 武陟县| 阿拉尔市| 固始县| 新昌县| 运城市| 凌云县| 兴仁县| 宁乡县| 林口县| 南安市| 瓦房店市| 武川县| 贵阳市| 濮阳市| 高清| 家居| 泰和县| 通州市| 开原市| 永登县| 镇平县| 类乌齐县| 沙坪坝区| 芜湖县| 德保县| 松原市| 红河县| 赣榆县| 宜宾县| 喀喇| 鹤壁市| 林周县| 侯马市| 兴国县| 老河口市| 万山特区| 朝阳县|