Does nuxt/VueRouter always need to have a _some.vue file name to pick up route params?
I wanted to have a button like so:
<NuxtLink :to="localePath({ name: 'musicdb', params: { search: page.shortTitle }})">
Search Title
</NuxtLink>
and send params to my route /musicdb/index.vue but this apparently does not work ...
however it works fine with a query string ...
<NuxtLink :to="localePath({ name: 'musicdb', query: { search: page.shortTitle }})">
Search Title
</NuxtLink>
Why does params: not work with an index.vue file? I am assuming it is a (base) routing issue?
params: called within index.vue are undefined and do not work!
<script>
// /musicdb/index.vue page
export default {
created() {
console.log(this.$route.params.search); // undefined
this.query = this.$route.params.search;
}
...
query string works fine:
<script>
// /musicdb/index.vue page
export default {
created() {
console.log(this.$route.query.search); // "hello search string"
this.query = this.$route.query.search;
}
...