页面之间跳转,打开新的一个页面显示在顶部
在main.js 中添加代码:
router.afterEach((to, from, next) => { window.scrollTo(0, 0) })
或者
在index.js里添加
export default new Router({ routes: [{...}], scrollBehavior(to, from,savedPosition) { return { x: 0, y: 0 } } })
页面之间跳转,打开新的一个页面显示在顶部
在main.js 中添加代码:
router.afterEach((to, from, next) => { window.scrollTo(0, 0) })
或者
在index.js里添加
export default new Router({ routes: [{...}], scrollBehavior(to, from,savedPosition) { return { x: 0, y: 0 } } })
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。