We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Learn more about funding links in repositories.
Report abuse
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
[vue] 切换到新路由时,页面要滚动到顶部或保持原先的滚动位置怎么做呢?
The text was updated successfully, but these errors were encountered:
滚动到顶部:在new Router()的时候,配置 scrollBehavior(to, from, savedPosition) { return { x: 0, y: 0 } }
Sorry, something went wrong.
通过router 的meta来记录需要保存滚动条的位置,在new VueRouter()时调用scrollBehavior(to, from, savedPosition) {return { x: 0, y: 0 }}的方法
ickt-5: vue-router 页面切换后保持在页面顶部而不是保持原先的滚动位置的办法: https://www.cnblogs.com/kugeliu/p/7172042.html vue2.0路由切换后页面跳转后新页面滚动位置不变BUG(滚动条回到顶部的位置): https://blog.csdn.net/ZHIYUANfL/article/details/79241655 返回到上次滚动位置: https://blog.csdn.net/yan263364/article/details/84402595
在路由实例中配置 scrollBehavior(ro,form,savedPosition){ //滚动到顶部 return {x:0,y:0} //保持原先的滚动位置 return {selector:falsy} }
No branches or pull requests
[vue] 切换到新路由时,页面要滚动到顶部或保持原先的滚动位置怎么做呢?
The text was updated successfully, but these errors were encountered: