优化首页定时器调整5分钟更新一次。

master
kevin jiang 6 years ago
parent 4b08de8a5c
commit f2dbe98c4f

@ -240,6 +240,7 @@
{'date': '1/1', '新增好友': 30, '新增好友(去重)': 25}, {'date': '1/1', '新增好友': 30, '新增好友(去重)': 25},
] ]
}, },
timer: null
} }
}, },
computed: { computed: {
@ -273,9 +274,11 @@
this.dateBtnClick('今日'); this.dateBtnClick('今日');
this.timingRefresh(); this.timingRefresh();
}, },
destroyed: function(){ //
// beforeDestroy() {
clearInterval(this.intervalId); if (this.timer){
clearInterval(this.timer);
}
}, },
methods: { methods: {
// //
@ -509,10 +512,9 @@
// //
timingRefresh: function () { timingRefresh: function () {
let that = this; let that = this;
let intervalId = setInterval(function () { that.timer = setInterval(function () {
that.dateBtnClick(that.dateBtnValue); that.dateBtnClick(that.dateBtnValue);
}, 1000 * 60); }, 1000 * 60 * 5);
this.intervalId = intervalId;
} }
} }

Loading…
Cancel
Save