This commit is contained in:
syuilo 2018-06-10 08:03:02 +09:00
parent c8dd8341ca
commit b29ff0e94b
1 changed files with 6 additions and 3 deletions

View File

@ -58,18 +58,21 @@ export default Vue.extend({
},
created() {
if (this.mode == 'relative' || this.mode == 'detail') {
this.tick();
this.tickId = setInterval(this.tick, 10000);
this.tickId = window.requestAnimationFrame(this.tick);
}
},
destroyed() {
if (this.mode === 'relative' || this.mode === 'detail') {
clearInterval(this.tickId);
window.clearTimeout(this.tickId);
}
},
methods: {
tick() {
this.now = new Date();
this.tickId = setTimeout(() => {
window.requestAnimationFrame(this.tick);
}, 10000);
}
}
});