Last active
September 16, 2023 08:54
-
-
Save moaoa/14cf230a652bbd65303cc157d10459dd to your computer and use it in GitHub Desktop.
VUE 2 WAY OF HANDLING THE SCROLL BEHAVIOR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const router = new Router({ | |
mode: "history", | |
routes, | |
scrollBehavior: (to, from, savedPosition) => { | |
if (to && to.hash) { | |
return { selector: to.hash }; | |
} else { | |
return { x: 0, y: 0 }; | |
} | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment