Open
Conversation
levy9527
requested changes
Aug 8, 2019
levy9527
reviewed
Aug 8, 2019
src/count-down.vue
Outdated
| mounted() { | ||
| if (this.autoplay) this.start() | ||
| window.addEventListener('unload', this.setSession) | ||
| if (sessionStorage.getItem(this.keepInSession)) { |
donaldshen
reviewed
Aug 9, 2019
src/count-down.vue
Outdated
| mounted() { | ||
| if (this.autoplay) this.start() | ||
| window.addEventListener('unload', this.setSession) | ||
| let session = sessionStorage.getItem(this.keepInSession) |
Contributor
There was a problem hiding this comment.
先判断this.keepInSession为true再去getItem吧
donaldshen
reviewed
Aug 9, 2019
donaldshen
reviewed
Aug 9, 2019
src/count-down.vue
Outdated
| session = JSON.parse(session) | ||
| const mountTime = session.rafId | ||
| ? Number(new Date()) - session.unloadTime | ||
| : 0 |
donaldshen
reviewed
Aug 9, 2019
| const mountTime = session.rafId | ||
| ? Number(new Date()) - session.unloadTime | ||
| : 0 | ||
| this.elapsed = this.time - (session.countdown - mountTime) |
Contributor
There was a problem hiding this comment.
直接记startTime不就行了?不用又记unloadTime又记countdown吧
donaldshen
reviewed
Aug 9, 2019
src/count-down.vue
Outdated
| beforeDestroy() { | ||
| cancelAnimationFrame(this.rafId) | ||
| this.setSession() | ||
| window.removeEventListener('unload', this.setSession) |
Contributor
There was a problem hiding this comment.
直接在beforeDestroy里setSession就行了吧,为啥要listen unload呢?
|
Deploy preview for femessage-count-down ready! Built with commit 0810503 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
用户需求
Docs
新增的 keep-alive.md