So I configured my rouse.scrollBehaviour.ts file in Nuxt 3. Here it is:
import { defineNuxtPlugin } from "#app";
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.$router.options.scrollBehavior = (to, from, savedPosition) => {
if (savedPosition) {
return savedPosition;
}
return { left: 0, top: 0, behaviour: "smooth" };
};
});
The problem is that I think it's scrolling earlier than the pages load, so there is a weird jumping effect on the pages.
Here is a video of the problem: https://user-images.githubusercontent.com/22452368/154849559-3974fc01-e265-486b-865b-55ee03053fa8.mp4
Can you please help me what is the problem here? Or is there a bug in Nuxt 3?