https://github.com/begueradj/bug-nuxt-hashbang-history
Call this method on click buttons to scroll down and up the same page:
methods: {
moveToAnchor(hashbang) {
this.$router.push(`#${hashbang}`)
this.$vuetify.goTo(`#${hashbang}`)
console.log(this.$route.hash) // this gives me the right thing
}
}
Navigating back and forward the browser history should work
Clicking on the browser's back or forward buttons does not move the page anywhere
@begueradj Does it work in pure vue + vue-router? :thinking:
I use only Nuxt.js but I will try it in Vue.js by the end of the day, thank you for the feedback.
@begueradj Just to make sure it's not a vue-router bug :relaxed:
@manniL You were right, there is this same issue with Vue.js (vue-router). I will try to understand what is going on before reporting a bug to Vue.js team. Somehow I think router.push() expects only routes, not anchors within the same route; but then it is mysterious that console.log(this.$route.hash) outputs the anchors in question. Thank you very much for the feedback, handsome and smart boy.
@begueradj Glad I could help :relaxed: