Answer the question
In order to leave comments, you need to log in
Why is vue-router not changing the data in the component?
Hello. The application has a header with navigation, let's say this kind:
<nav>
<router-link
tag="a"
:to="{ name: item.name, params: { slug: item.slug }}"
>
{{ item.text }}
</router-link>
</nav>
[
{
name: 'InnerTable',
slug: 'data-1',
text: 'Link 1',
},
{
name: 'InnerTable',
slug: 'data-2',
text: 'Link 2',
}
]
{
path: '/:slug',
name: 'InnerTable',
component: AppInnerTable,
props: true
}
created: function() {
let data_slug = this.$route.params.slug
Axios.get(`/data/${data_slug}.json`)
.then(res => {
this.table_data = res.data
})
.catch(error => {
console.log(error)
})
}
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