scroll on top vue js route 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 vue
<router-link @click.native="$scrollToTop">