Open calin-darie opened 1 year ago
Dirty hack. Until this gets fixed in the official version, I've patched the router global hooks:
export default ({
Vue, // the version of Vue being used in the VuePress app
options, // the options for the root Vue instance
router, // the router instance for the app
siteData // site metadata
}) => {
// ...apply enhancements for the site.
router.beforeHooks =[];
router.beforeEach((to, from, next) => { // fixed version
Please let's fix vuepress v1 and let me delete this abomination.
Bug report
Steps to reproduce
mypage.html#mytitle
, navigate tomypage#mytitle
by following external links or by pasting the URL in the browser \ Examples:What is expected?
What is actually happening?
Any URL fragment hash and query string are erased by this router guard: https://github.com/vuejs/vuepress/blob/38e98634af117f83b6a32c8ff42488d91b66f663/packages/%40vuepress/core/lib/client/redirect.js
Other relevant information
The fix is to patch the router object, instead of passing on just the path. Let me know if you'd approve a pull request:
npx vuepress info
in my VuePress project: As mentioned above, it reproduces with the official vuepress docs, so this is not particularly relevant.