Skip to content

Instantly share code, notes, and snippets.

@softiconic
Last active December 2, 2023 18:46
Show Gist options
  • Save softiconic/10b6cea722d4a245376eabadd5efa982 to your computer and use it in GitHub Desktop.
Save softiconic/10b6cea722d4a245376eabadd5efa982 to your computer and use it in GitHub Desktop.
In Vue.js, scroll from the top to the bottom of a routed page.
scrollBehavior (to, from, savedPosition) {
if (savedPosition) {
return savedPosition
} else {
return { x: 0, y: 0 }
}
}
or try,
scrollBehavior() {
document.getElementById('app').scrollIntoView();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment