Use a custom hook to reset scroll before each route unlike scrollbehavior

pull/345/head
cagataycivici 2020-05-13 17:10:36 +03:00
parent 78b3cb16f4
commit f50c9b46f7
2 changed files with 6 additions and 4 deletions

View File

@ -162,6 +162,11 @@ Vue.component('Galleria', Galleria);
Vue.component('CodeHighlight', CodeHighlight); Vue.component('CodeHighlight', CodeHighlight);
router.beforeEach(function (to, from, next) {
window.scrollTo(0, 0);
next();
});
new Vue({ new Vue({
router, router,
render: h => h(App) render: h => h(App)

View File

@ -675,8 +675,5 @@ export default new Router({
name: 'galleriacaption', name: 'galleriacaption',
component: () => import('./views/galleria/GalleriaCaptionDemo.vue') component: () => import('./views/galleria/GalleriaCaptionDemo.vue')
} }
], ]
scrollBehavior() {
return {x: 0, y: 0};
}
}); });