Is there any way to change mode for vue router in vuepress

Viewed 1037

Currently the property mode of vue router in vuepress is 'history'

I want to change the property mode of vue router in vuepress to hash

Is there any way to achieve this?

I tried that I created a file enhanceApp.js like bellow in .vuepress directory ( https://vuepress.vuejs.org/guide/basic-config.html#app-level-enhancements )

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
  isServer // is this enhancement applied in server-rendering or client
}) => {
  router.mode = 'hash';


}

But there is no luck.

1 Answers
// .vuepress\enhanceApp.js

import VueRouter from 'vue-router'

export default ({Vue, options, router, siteData
}) => {
  router = new VueRouter({
    ...router.options,
    mode: 'hash',
  })
}
Related