K
K
kiranananda2018-08-08 14:51:44
Vue.js
kiranananda, 2018-08-08 14:51:44

Why does vue-router remove the component on transition?

When moving from one component to another, vue removes the previous component. Is this normal or can I leave it somehow so that it does not render on a new one?

const router = new Router({
  routes: [
    {
      path: '/',
      name: 'MainPage',
      component: MainPage
    },
    {
      path: '/contacts',
      name: 'ContactsPage',
      component: ContactsPage
    }
  ]
})


<router-view></router-view>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-08-08
@kiranananda

This is fine...

Fine.
You can - use keep-alive .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question