Answer the question
In order to leave comments, you need to log in
Why does vue router work crookedly?
Good day to all!
After I added optional parameters to the routes, the view stopped going to these routes by url (with navigation to this.$router.push(...)
and everything is in order)
Now when I try to go (using the address bar) to (i.e. orders.order) everything is in order , the component from (Order) is rendered, although it should be an EditOrder, with the same as with .
BUT: If you enter or (with an optional parameter) in the url, everything works fine and the necessary pages are displayed.<router-link>
/orders/123
/orders/123/edit
/orders/123
/orders/123/copy
/orders/123/edit
/orders/123/название_магазина/edit
/orders/123/название_магазина/copy
{
path: '/orders',
components: {
default: ChildView
},
children: [
// ......
{
name: 'orders.order',
path: ':orderId/:shop?',
components: { default: Order },
meta: { title: 'Просмотр заказа' }
},
{
name: 'orders.order.edit',
path: ':orderId/:shop?/edit',
components: { default: EditOrder },
meta: { title: 'Редактировать заказ', needAcceptQuit: true }
},
{
name: 'orders.order.copy',
path: ':orderId/:shop?/copy',
components: { default: CopyOrder },
meta: { title: 'Копировать заказ', needAcceptQuit: true }
}
]
},
{
path: ':orderId/:shop?',
components: {
default: ChildView
},
children: [
{
name: 'orders.order',
path: '',
components: { default: Order },
meta: { title: 'Просмотр заказа' }
},
{
name: 'orders.order.edit',
path: 'edit',
components: { default: EditOrder },
meta: { title: 'Редактировать заказ', needAcceptQuit: true }
},
{
name: 'orders.order.copy',
path: 'copy',
components: { default: CopyOrder },
meta: { title: 'Копировать заказ', needAcceptQuit: true }
}
]
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question