Fix scrolling issue.

Looks like Vue Router's scrollBehavior is broken.
This commit is contained in:
FireMasterK
2021-07-05 00:59:19 +05:30
parent aa81677450
commit 29b49de40c
2 changed files with 4 additions and 0 deletions

View File

@@ -149,6 +149,7 @@ export default {
this.getVideoData(); this.getVideoData();
this.getSponsors(); this.getSponsors();
this.getComments(); this.getComments();
window.scrollTo(0, 0);
} }
}, },
}, },

View File

@@ -34,6 +34,9 @@ const routes = [
const router = createRouter({ const router = createRouter({
history: createWebHistory(), history: createWebHistory(),
routes, routes,
scrollBehavior: function(_to, _from, savedPosition) {
return savedPosition ? savedPosition : window.scrollTo(0, 0);
},
}); });
export default router; export default router;