当页面很长滚动首页时,点击滚动位置所在页面,
跳转之后的子页面也会跟着到之前首页滚动到的位置,解决方法在routes下面再加一项
export default new Router({
routes: [
{
path: '/',
name: 'Home',
component: Home
},
{
path: '/detail/:id',
name: 'Detail',
component: Detail
}
],
scrollBehavior (to, from, savedPosition) {
return { x: 0, y: 0 }
}
})