1

I use vue-cli created an empty Hello World project, add a HelloWorld2.vue in components which basically copy from HelloWorld.vue. then add the new one to the router/index.js like this:

export default new Router({
  routes: [
    {
      path: '/',
      component: HelloWorld
    },
    {
      path: '/HelloWorld2',
      component: HelloWorld2
    }
  ]
})

Question: When I trying to access HelloWorld2

1. localhost/#/HelloWorld2 //right
2. localhost/HelloWorld2   //wrong, redirect to HelloWorld

What's meaning of /#/?

eis
  • 51,991
  • 13
  • 150
  • 199
JustWe
  • 4,250
  • 3
  • 39
  • 90
  • 1
    Possible duplicate of [Usage of Hash(#) in URL](https://stackoverflow.com/questions/21850093/usage-of-hash-in-url) – eis Dec 28 '17 at 06:54

1 Answers1

0

If you want to remove the hash symbol, you should pass mode: 'history', to your router as:

export default new Router({
  routes: [...],
  mode: 'history'
})

This will remove the hash # from your URLs

samayo
  • 16,163
  • 12
  • 91
  • 106