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

        }
    });

 

posted @ 2017-11-19 10:56  lunawzh  阅读(13421)  评论(0编辑  收藏  举报