Skip to content

Instantly share code, notes, and snippets.

@kp-gists
Created January 5, 2024 09:11
Show Gist options
  • Save kp-gists/f02e49556004a264efd33d0dbde9a96e to your computer and use it in GitHub Desktop.
Save kp-gists/f02e49556004a264efd33d0dbde9a96e to your computer and use it in GitHub Desktop.
vue scroll to element
// scroll to categories
const hash = this.$route.query.hash
if (hash == 'categories') {
console.log('🚀 ~ hash:', hash)
const el = document.getElementById('categories')
el.scrollIntoView({ behavior: 'smooth' })
this.$router.replace({ query: null })
} else {
console.log('this.$route.params', this.$route.query)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment