vue清除定时器

        getTime() {
            let timer = setTimeout(() => {
                this.time = tools_time.getDate();
                console.log(this.time);
                this.getTime();
            }, 1000);

            this.$once("hook:beforeDestroy", () => {
                clearTimeout(timer);
            });
        },

你可能感兴趣的:(vue清除定时器)