T
T
tuxx2017-09-18 15:00:14
JavaScript
tuxx, 2017-09-18 15:00:14

Is Vue-router reloading the page in a dynamic path for some reason?

Setting up the router is simple:

const router = new VueRouter({
  mode: 'history',
  routes: [
    {
      path: '/',
      component: Home
    },
    {
      path: '/item/:id',
      component: ItemDetail
    },
    {
      path: '/profile/',
      component: Profile
    }
  ]
})

It goes to /profile/ normally, but to /item/1234 only with a full reload of the browser page.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ilya Gerasimov, 2017-09-18
@Omashu

Somewhere there is an error, so js scripts stop working, and therefore, instead of catching the click event on the link, a simple transition is triggered, as in the case of off. js script, see console

T
twan, 2018-10-18
@twan

You need to import your ItemDetail component into App.vue

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question