function scrollBehavior(to: { hash: any }, from: any, savedPosition: any) {
if (savedPosition) {
return savedPosition
}
if (to.hash) {
return { selector: to.hash }
}
return { x: 0, y: 0 }
}
const router = createRouter({
history: createWebHistory(),
routes,
linkActiveClass: 'active',
scrollBehavior,
})