This commit is contained in:
parent
c8dd8341ca
commit
b29ff0e94b
|
@ -58,18 +58,21 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
if (this.mode == 'relative' || this.mode == 'detail') {
|
if (this.mode == 'relative' || this.mode == 'detail') {
|
||||||
this.tick();
|
this.tickId = window.requestAnimationFrame(this.tick);
|
||||||
this.tickId = setInterval(this.tick, 10000);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
destroyed() {
|
destroyed() {
|
||||||
if (this.mode === 'relative' || this.mode === 'detail') {
|
if (this.mode === 'relative' || this.mode === 'detail') {
|
||||||
clearInterval(this.tickId);
|
window.clearTimeout(this.tickId);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
tick() {
|
tick() {
|
||||||
this.now = new Date();
|
this.now = new Date();
|
||||||
|
|
||||||
|
this.tickId = setTimeout(() => {
|
||||||
|
window.requestAnimationFrame(this.tick);
|
||||||
|
}, 10000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue