Answer the question
In order to leave comments, you need to log in
Can't figure out router vue, can't figure out children?
There is such a path, I made it in the componenttransfers.vue
created() {this.$router.push({ path: '/transfers/new' })},
it helps only with the 1st press, and if you press it the 2nd time, it already tears off /transfers
simply, but I need it to always /transfers/new
be{
path: '/transfers',
name: 'transfers',
component: transfers,
children: [
{
path: 'new',
name: 'new',
component: transferFormWidget
},
]
},
Answer the question
In order to leave comments, you need to log in
You haven't written where you're clicking, but I'm assuming that the created hook is fired when the component is created.
vue-router tries to reuse components, so the second time created is not fired.
I don't think it's correct to write this, it's better like this:
{
path: '/transfers',
name: 'transfers',
component: transfers,
children: [
{
path: 'new',
name: 'new',
component: transferFormWidget
},
{
path: '',
redirect: 'new'
}
]
},
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question