Dolphin
Dolphin

Reputation: 38601

Vue router url could not open page

I am using Vue("vue": "^2.5.2") to make a SPA,this is my route("vue-router": "^3.0.1"):

routes: [
    {
      path: '/',
      name: 'Home',
      component: Home
    }]

when I request : http://localhost:8080.It could open the page.But when I tweak the route like this:

routes: [
        {
          path: '/home',
          name: 'Home',
          component: Home
        }]

And I request : http://localhost:8080/home .It could not open the page.Why would this happen ,how to fix it?

Upvotes: 0

Views: 395

Answers (1)

Lupu Ștefan Alex
Lupu Ștefan Alex

Reputation: 281

As stated in the vue router docs:

The default mode for vue-router is hash mode - it uses the URL hash to simulate a full URL so that the page won't be reloaded when the URL changes.

You should find your page at http://localhost:8080/#/home

You can read more about this here

Upvotes: 3

Related Questions