vue-scrollactive
vue-scrollactive copied to clipboard
how to prevent replacing the URL with tag
this is what happens:
- The last part of whatever my URL is is replaced with the
#tag

- Surely the intended behaviour is that the
#should be appended to the URL...?
eg. me.me/background when a link is clicked: me.me/background#about-me
instead of background being replaced... right?
I was able to "workaround" this by doing
:modifyUrl="false"
and then I added a "click" event on each <a> element on which I execute:
/**
* @param {MouseEvent} event
*/
setUrlHash(event) {
const activeTocHash = event.srcElement.getAttribute('href')
const activeTocId = activeTocHash.replace('#', '')
setTimeout(() => {
location.hash = activeTocId
}, SCROLL_DURATION)
},
:modifyUrl="false" doesn't have any effect for me