fix(CountDown): should clear timer when deactivated (#4919)

This commit is contained in:
neverland
2019-11-04 20:32:39 +08:00
committed by GitHub
parent e0e597d164
commit b630b6b035
2 changed files with 52 additions and 7 deletions

View File

@@ -44,6 +44,21 @@ export default createComponent({
}
},
activated() {
if (this.keepAlivePaused) {
this.counting = true;
this.keepAlivePaused = false;
this.tick();
}
},
deactivated() {
if (this.counting) {
this.pause();
this.keepAlivePaused = true;
}
},
beforeDestroy() {
this.pause();
},