Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
f58cdd4f1c
@ -37,6 +37,7 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.initAnimation()
|
||||
window.addEventListener('visibilitychange', this.visibilityChangeHandler)
|
||||
},
|
||||
methods: {
|
||||
initAnimation() {
|
||||
@ -49,7 +50,14 @@ export default {
|
||||
this.currentIndex = this.nextIndex(this.currentIndex)
|
||||
}
|
||||
}, 1000)
|
||||
}, 3000)
|
||||
}, 4000)
|
||||
},
|
||||
pauseAnimation() {
|
||||
clearInterval(timer)
|
||||
},
|
||||
visibilityChangeHandler() {
|
||||
if (document.hidden) this.pauseAnimation()
|
||||
else this.initAnimation()
|
||||
},
|
||||
nextIndex(idx) {
|
||||
return idx < this.len - 1 ? idx + 1 : 0
|
||||
@ -57,6 +65,7 @@ export default {
|
||||
},
|
||||
beforeDestroy() {
|
||||
timer = null
|
||||
window.removeEventListener('visibilitychange', this.visibilityChangeHandler)
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user