vue-scrollactive icon indicating copy to clipboard operation
vue-scrollactive copied to clipboard

how to prevent replacing the URL with tag

Open mesqueeb opened this issue 5 years ago • 2 comments

this is what happens:

  • The last part of whatever my URL is is replaced with the # tag

2020-10-08 09 44 18

  • 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?

mesqueeb avatar Oct 08 '20 00:10 mesqueeb

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)
    },

mesqueeb avatar Oct 14 '20 12:10 mesqueeb

:modifyUrl="false" doesn't have any effect for me

Sogl avatar May 29 '23 11:05 Sogl