Skip to content

Instantly share code, notes, and snippets.

@ezaurum
Created January 22, 2021 13:48
Show Gist options
  • Save ezaurum/50c5e02c35558d8220cc5f65cee38ab5 to your computer and use it in GitHub Desktop.
Save ezaurum/50c5e02c35558d8220cc5f65cee38ab5 to your computer and use it in GitHub Desktop.
vue hash 로 스크롤
mounted() {
Vue.nextTick(() => {
const hash = this.$route.hash
if (hash) {
const element = document.querySelector(hash)
document.scrollingElement.scroll({
top: element.offsetTop,
})
}
})
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment