Vue 定时执行函数

Posted lunawzh

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Vue 定时执行函数相关的知识,希望对你有一定的参考价值。

var app = new Vue({
        el: #app,
        data: {
            count: 1,
        },
        filters: {
         
        },
        mounted: function () {
            this.$nextTick(function () {
                setInterval(this.timer, 1000);
            })
        },
        methods: {
         timer: function () {
                if (this.count > 0) {
                    this.count++;
                }
            }
        },
        watch: {

        },
        computed: {

        }
    });

 

以上是关于Vue 定时执行函数的主要内容,如果未能解决你的问题,请参考以下文章