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: {

        }
    });
原文地址:https://www.cnblogs.com/lunawzh/p/7859266.html