1: in mounted () {
this.timer = setInterval(() => {
this.rechargeInfo();
}, 3000);
} create a timer.
2:
beforeDestroy () {
this.timer = null;
clearInterval(this.timer);
},
destroyed () {
this.timer = null;
clearInterval(this.timer);
} to clear
.
in theory, the timer is cleared when the component is destroyed. ,
but: the timer is still running when you jump to another page.
question.