I am using locomotive-scroll with nuxtjs and got some wired behave when changing route. after changing the route every time the page is start where i left scrolling my previous page. i tried nuxt scrollBehavior function which is work fine without using locomotive-scroll.
Below is my code which i put in my default.vue file
@Watch('$route')
handleRouteChange(route: any, oldRoute: any) {
this.$nuxt.$emit('update-locomotive');
}
mounted() {
this.$nuxt.$on('update-locomotive', () => {
(this as any).$refs.scroller.locomotive?.update();
});
if (process.browser && window) {
this.retrieveCredential();
}
}
I am watching route change and updating the locomotive.
Thanks in advance