Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: restore scroll in keep-alive #724

Merged
merged 2 commits into from Oct 10, 2022
Merged

fix: restore scroll in keep-alive #724

merged 2 commits into from Oct 10, 2022

Conversation

flyingbirdhub
Copy link
Contributor

when we use router-view and keep alive with RecycleScroller, if we change the router, then back, we will see the scroller position will change to the top. we need to keep the position

@zhoucan38
Copy link

mark

const lastPosition = this.$_lastUpdateScrollPosition;
if (typeof lastPosition === 'number') {
this.$nextTick(() => {
this.scrollToPosition(lastPosition);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this have to be nextTick? The DOM should be ready by the time activated is called.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has been a long time. i do not remember very clearly. May be it is because when (positionDiff < itemSize) in updateVisibleItems method, something goes wrong with view calculated, So i make it asynchronous

@Akryum Akryum changed the base branch from master to v1 October 10, 2022 17:38
@Akryum Akryum changed the title add RecycleScroller to support keep alive, and scroll to the last pos… fix: restore scroll in keep-alive Oct 10, 2022
@Akryum Akryum merged commit 5011e06 into Akryum:v1 Oct 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants