Skip to content

Commit 63e992c

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix/package-skeleton
2 parents 98ba477 + 59691eb commit 63e992c

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

app/router.options.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import type { RouterConfig } from 'nuxt/schema'
2+
3+
export default {
4+
scrollBehavior(to, _from, savedPosition) {
5+
// If the browser has a saved position (e.g. back/forward navigation), restore it
6+
if (savedPosition) {
7+
return savedPosition
8+
}
9+
10+
// If navigating to a hash anchor, scroll to it
11+
if (to.hash) {
12+
return { el: to.hash, behavior: 'smooth' }
13+
}
14+
15+
// Otherwise, scroll to the top of the page
16+
return { left: 0, top: 0 }
17+
},
18+
} satisfies RouterConfig

knip.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const config: KnipConfig = {
44
workspaces: {
55
'.': {
66
entry: [
7+
'app/router.options.ts!',
78
'app/app.vue!',
89
'app/error.vue!',
910
'app/pages/**/*.vue!',

0 commit comments

Comments
 (0)