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

vuerouter2.0 路由切换保留页面滚动位置 #71

Open
5Mi opened this issue Mar 16, 2017 · 0 comments
Open

vuerouter2.0 路由切换保留页面滚动位置 #71

5Mi opened this issue Mar 16, 2017 · 0 comments

Comments

@5Mi
Copy link
Owner

5Mi commented Mar 16, 2017

使用 scrollBehavior 只是在切换时记录了整个页面的滚动,如果是记录某个组件内部的滚动
可以在路由离开之前beforeRouteLeave钩子中记录组件的滚动距离,存在store中(当前组件的module中),在activated钩子中(用keep-alive缓存组件)还原滚动位置
组件内滚动

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant