• <noscript id="ggggg"><dd id="ggggg"></dd></noscript>
    <small id="ggggg"></small> <sup id="ggggg"></sup>
    <noscript id="ggggg"><dd id="ggggg"></dd></noscript>
    <tfoot id="ggggg"></tfoot>
  • <nav id="ggggg"><cite id="ggggg"></cite></nav>
    <nav id="ggggg"></nav>
    成人黃色A片免费看三更小说,精品人妻av区波多野结衣,亚洲第一极品精品无码,欧美综合区自拍亚洲综合,久久99青青精品免费观看,中文字幕在线中字日韩 ,亚洲国产精品18久久久久久,黄色在线免费观看

    使用vue寫一個計時器

    2021-5-18    前端達人

    **

    首先我們要知道setTimeout和setInterval的區別

    **
    setTimeout只在指定時間后執行一次,代碼如下:

    <script>  
    //定時器 異步運行  
    function hello(){  
    alert("hello");  
    }  
    //使用方法名字執行方法  
    var t1 = window.setTimeout(hello,1000);  
    var t2 = window.setTimeout("hello()",3000);//使用字符串執行方法  
    window.clearTimeout(t1);//去掉定時器  
    </script> 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10

    setInterval以指定時間為周期循環執行,代碼如下:

    //實時刷新時間單位為毫秒  
    setInterval('refreshQuery()',8000);   
    /* 刷新查詢 */  
    function refreshQuery(){  
       $("#mainTable").datagrid('reload',null);  
    } 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    一般情況下setTimeout用于延遲執行某方法或功能,
    setInterval則一般用于刷新表單,對于一些表單的實時指定時間刷新同步
    **

    計時器

    **
    HTML代碼

    <div class="father">
            <ul>
                <li>{{one}}<span>:</span></li>
                <li>{{two}}<span>:</span></li>
                <li>{{three}}</li>
            </ul>
            <el-button type="primary" @click="startHandler">開始</el-button>
            <el-button type="primary" @click="endHandler">暫停</el-button>
        </div> 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    JAVASCRIPT代碼

    <script>
    export default {
      name: 'HelloWorld',
      data(){
          return {
            flag: null,
            one : '00', // 時
            two : '00', // 分
            three : '00', // 秒
            abc : 0, // 秒的計數
            cde : 0, // 分的計數
            efg : 0, // 時的計數
          }
      },
      props: {
        msg: String
      },
      mounted() {
    
      },
      methods:{
      // 開始計時
        startHandler(){
            this.flag = setInterval(()=>{
                if(this.three === 60 || this.three === '60'){
                    this.three = '00';
                    this.abc = 0;
                    if(this.two === 60 || this.two === '60'){
                        this.two = '00';
                        this.cde = 0;
                        if(this.efg+1 <= 9){
                            this.efg++;
                            this.one = '0' + this.efg;
                        }else{
                            this.efg++;
                            this.one = this.efg;
                        }
                    }else{
                        if(this.cde+1 <= 9){
                            this.cde++;
                            this.two = '0' + this.cde;
                        }else{
                            this.cde++;
                            this.two = this.cde;
                        }
                    }
                }else{
                    if(this.abc+1 <= 9){
                        this.abc++;
                        this.three = '0' + this.abc;
                    }else{
                        this.abc++;
                        this.three=this.abc;
                    }
                }
    
            },100)
        },
        // 暫停計時
        endHandler(){
            this.flag = clearInterval(this.flag)
        }
      }
    }
    </script> 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65

    效果如下:
    在這里插入圖片描述




    藍藍設計建立了UI設計分享群,每天會分享國內外的一些優秀設計,如果有興趣的話,可以進入一起成長學習,請掃碼藍小助,報下信息,藍小助會請您入群。歡迎您加入噢~~希望得到建議咨詢、商務合作,也請與我們聯系。

    截屏2021-05-13 上午11.41.03.png


    文章來源:csdn     作者:rock_23

    分享此文一切功德,皆悉回向給文章原作者及眾讀者.
    免責聲明:藍藍設計尊重原作者,文章的版權歸原作者。如涉及版權問題,請及時與我們取得聯系,我們立即更正或刪除。

    藍藍設計m.lzhte.cn )是一家專注而深入的界面設計公司,為期望卓越的國內外企業提供卓越的UI界面設計、BS界面設計 、 cs界面設計 、 ipad界面設計 、 包裝設計 、 圖標定制 、 用戶體驗 、交互設計、 網站建設 平面設計服務

    日歷

    鏈接

    個人資料

    藍藍設計的小編 http://m.lzhte.cn

    存檔

    主站蜘蛛池模板: 成人性爱网站| 91偷拍视频在线观看| 夜夜高潮夜夜爽高清视频一| 国产成 人 综合 亚洲专区| 国产99视频精品免费专区| 男人j进女人p免费视频直播| 国内99精品激情视频精品| 亚洲欧美日韩高清在线电影| 日韩国产精品视频在放| 免费国产99久久久香蕉| 真正免费**毛片在线播放| 亚洲最大有声小说AV网| 福利一区二区在线视频| 黄色片子一区二区三区| 国产精品亚洲А∨天堂免下载 | 四虎国产精品永久地址49| 18禁黄久久久aaa片广濑美月| 精品久久久中文字幕一区| 免费精品国自产拍在线不卡| 国产成人人综合亚洲欧美丁香花| 中文字幕AV无码专区第一页| 亚洲欧美日本韩国综合在线观看| 夜夜添无码试看一区二区三区| 变态另类第一页| AV视屏| 少妇人妻偷人一区二区| 五月婷婷色| 国产高清色高清在线观看| 麻豆乱码国产一区二区三区| 日本道综合一本久久久88| 推油少妇久久99久久99久久 | 国产无遮挡裸体免费直播| 在线观看国产精品第一区免费| 免费欧美性爱视频| 成人深夜节目在线观看| 亚洲熟女精品一区二区三区| 色情一区二区三区免费看| 日韩精品中文乱码在线观看| 精品国产免费久久久久久| 人妻无码久久中文字幕专区| 亚洲美女高清无水av|