定时访问实时数据

feature/nanjing-wuliu
yiming 3 years ago
parent 89b3c52aeb
commit 67c28460a9

@ -151,6 +151,30 @@ export default {
}, },
mounted() { mounted() {
this.request(); this.request();
this.$nextTick(() => {
this.getRealTimeCheck();
})
this.$on('hook:activated', () => {
this.timer = window.setInterval(this.getRealTimeCheck, 3000);
})
this.timer = window.setInterval(this.getRealTimeCheck, 3000);
this.$on('hook:deactivated', () => {
clearInterval(this.timer)
this.timer = null
})
},
beforeDestroy() {
console.log("beforeDestroy")
window.clearInterval(this.timer);
this.timer = null;
},
created() {
},
destroyed() {
window.clearInterval(this.timer);
this.timer = null;
}, },
methods: { methods: {
request() { request() {

Loading…
Cancel
Save