Created
January 22, 2021 13:48
-
-
Save ezaurum/50c5e02c35558d8220cc5f65cee38ab5 to your computer and use it in GitHub Desktop.
vue hash 로 스크롤
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
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