Skip to content

Commit 9fb3fb7

Browse files
committed
feat: check for savePos param in scrollBehavior method, allows us to save scroll position when updating query string params
1 parent 2b1e45d commit 9fb3fb7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/router/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ const routes = [
3939
const router = createRouter({
4040
history: createWebHistory(),
4141
routes,
42-
scrollBehavior() { document.getElementsByTagName('html')[0].scrollIntoView() }
42+
scrollBehavior(to) {
43+
if (!to.params.saveScrollPos) { document.getElementsByTagName('html')[0].scrollIntoView() }
44+
}
4345
})
4446

4547
router.beforeEach(to => {

0 commit comments

Comments
 (0)