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

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

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

1、先看看效果圖

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

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

2、代碼實(shí)現(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")
            // 將鼠標(biāo)設(shè)置為不可點(diǎn)擊狀態(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變化,移除不可點(diǎn)擊樣式
          $(".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 驗(yàn)證碼界面實(shí)現(xiàn)點(diǎn)擊后標(biāo)灰并設(shè)置div按鈕不可點(diǎn)擊狀態(tài)就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • vue實(shí)現(xiàn)勻速輪播效果

    vue實(shí)現(xiàn)勻速輪播效果

    這篇文章主要為大家詳細(xì)介紹了vue實(shí)現(xiàn)勻速輪播效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2020-06-06
  • vue+layui實(shí)現(xiàn)select動(dòng)態(tài)加載后臺數(shù)據(jù)的例子

    vue+layui實(shí)現(xiàn)select動(dòng)態(tài)加載后臺數(shù)據(jù)的例子

    今天小編就為大家分享一篇vue+layui實(shí)現(xiàn)select動(dòng)態(tài)加載后臺數(shù)據(jù)的例子,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2019-09-09
  • Vue中如何實(shí)現(xiàn)字符串換行

    Vue中如何實(shí)現(xiàn)字符串換行

    這篇文章主要介紹了Vue中如何實(shí)現(xiàn)字符串換行問題,具有很好的參考價(jià)值,希望對大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-10-10
  • 詳解如何在vue項(xiàng)目中使用eslint+prettier格式化代碼

    詳解如何在vue項(xiàng)目中使用eslint+prettier格式化代碼

    在開發(fā)中我們需要一種能夠統(tǒng)一團(tuán)隊(duì)代碼風(fēng)格的工具,作為強(qiáng)制性的規(guī)范,統(tǒng)一整個(gè)項(xiàng)目的代碼風(fēng)格,這篇文章主要介紹了詳解如何在vue項(xiàng)目中使用eslint+prettier格式化代碼,需要的朋友可以參考下
    2018-11-11
  • vue中兄弟組件傳值的兩種方式小結(jié)

    vue中兄弟組件傳值的兩種方式小結(jié)

    這篇文章主要介紹了vue中兄弟組件傳值的兩種方式小結(jié),具有很好的參考價(jià)值,希望對大家有所幫助。
    2022-07-07
  • Vue實(shí)現(xiàn)答題功能

    Vue實(shí)現(xiàn)答題功能

    最近接手做一個(gè)前端小項(xiàng)目,基于vue實(shí)現(xiàn)答題功能,具體功能有判斷用戶是否答對,答對的話跳到下一題,答錯(cuò)的話彈窗告訴用戶有錯(cuò)題,請重新答題,功能非常人性化,對實(shí)現(xiàn)代碼感興趣的朋友一起看看吧
    2021-06-06
  • Vuex的插件vuex-persistedstate數(shù)據(jù)持久化存儲(chǔ)操作

    Vuex的插件vuex-persistedstate數(shù)據(jù)持久化存儲(chǔ)操作

    這篇文章主要介紹了Vuex的插件vuex-persistedstate數(shù)據(jù)持久化存儲(chǔ)操作,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友參考下吧
    2023-12-12
  • Vue3實(shí)現(xiàn)刷新頁面局部內(nèi)容的示例代碼

    Vue3實(shí)現(xiàn)刷新頁面局部內(nèi)容的示例代碼

    本文主要介紹了Vue3實(shí)現(xiàn)刷新頁面局部內(nèi)容的示例代碼,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2022-07-07
  • vue實(shí)現(xiàn)側(cè)邊定位欄

    vue實(shí)現(xiàn)側(cè)邊定位欄

    這篇文章主要為大家詳細(xì)介紹了vue實(shí)現(xiàn)側(cè)邊定位欄,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-07-07
  • vue項(xiàng)目展示pdf文件的方法實(shí)現(xiàn)

    vue項(xiàng)目展示pdf文件的方法實(shí)現(xiàn)

    本文主要介紹了vue項(xiàng)目展示pdf文件的方法實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2023-07-07

最新評論