Closed lordroseman closed 4 years ago
@lordroseman have a look at this example -> https://codesandbox.io/s/vue-routing-example-jbokc?fontsize=14&hidenavigation=1&theme=dark
Just watch on $route and set scrollTop of scroll container on 0.
If you need to setup global scrollbehavior by router options you have to query selector with scroll container and setup scroll top to 0. Because there is not easy access to scroll container.
Thats a good option too, this is what i did,
If you need to setup global scrollbehavior by router options you have to query selector with scroll container and setup scroll top to 0. Because there is not easy access to scroll container.
_router.afterEach((to, from) => {
const container = document.querySelector(".wrapper .ps");
container.scrollTop = 0;
});
Hi,
How can I make it work with Vue router's scrollBehavior Option?