vue change route scroll middle? code example
Example 1: scroll to top router link vue
export default new Router({
scrollBehavior() {
return { x: 0, y: 0 };
},
routes: [
{
path: '/',
name: 'Home',
component: Home
}
],
mode: 'history'
});
Example 2: scroll to top router link vue
scrollBehavior(to, from, savedPosition) { return { x: 0, y: 0 };}