Answer the question
In order to leave comments, you need to log in
How to keep track of route parameters updates?
Given:
{
path: '/data-list/:list_slug',
name: 'data_list',
component: data_list,
meta: {
requiresAuth: true,
breadcrumbs: [
{
'url': 'data_list',
'title': 'Data'
},
{
'title': ''
}
]
},
children: [
{
path: ':list_id',
name: 'data_list.edit',
component: data_list
}
]
}
:list_slug
Answer the question
In order to leave comments, you need to log in
Try like this:
watch: {
'$route.params.list_slug': function (listSlug) {
console.log(listSlug); // выводим новое значение параметра роута
this.doSomething(); // выполняете что нужно
},
},
watch: {
'$route': function (to, from) {
// выполняем что-либо, когда роут меняется
},
},
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question