Vue.JS's router has "#" even with history mode enabled

I tried to remove # in URL of my VueJS webapp, but even with

const router = createRouter({
    mode: 'history',
    history: createWebHashHistory(),
    routes
})

# still appear.
I’m pretty sure it’s due to the createWebHashHistory function, but I can’t remove it, or else, UI doesn’t display.

So i tried another thing :

const router = createRouter({
    history: true,
    routes
})

but ui doesn’t even display here.

The Vue.JS’s official documentation doesn’t help me on that point, could anyone help me there ?

23 thoughts on “Vue.JS's router has "#" even with history mode enabled”

  1. This worked for me:

    const router = new VueRouter({
      mode: 'history',
      routes
    })
    

    So it is either history: createWebHashHistory(), or the createRouter.

    Reply

Leave a Comment