首页切换到其他页,销毁自动刷新

master
wangyinjia 6 years ago
parent 0a62250972
commit 3d88e6ac16

@ -192,6 +192,7 @@
data() { data() {
return { return {
userId: JSON.parse(sessionStorage.getItem("loginInfo")).userId, userId: JSON.parse(sessionStorage.getItem("loginInfo")).userId,
intervalId : 0,
// //
spinShow: false, spinShow: false,
dateBtnValue: "今日", dateBtnValue: "今日",
@ -272,6 +273,10 @@
this.dateBtnClick('今日'); this.dateBtnClick('今日');
this.timingRefresh(); this.timingRefresh();
}, },
destroyed: function(){
//
clearInterval(this.intervalId);
},
methods: { methods: {
// //
resizeWindow: function () { resizeWindow: function () {
@ -472,9 +477,10 @@
// //
timingRefresh: function () { timingRefresh: function () {
let that = this; let that = this;
setInterval(function () { let intervalId = setInterval(function () {
that.dateBtnClick(that.dateBtnValue); that.dateBtnClick(that.dateBtnValue);
}, 1000 * 60); }, 1000 * 60);
this.intervalId = intervalId;
} }
} }

Loading…
Cancel
Save