NuxtJS: passing multiple parameters to a page

762 Views Asked by At

In nuxt, how do you pass multiple parameters besides the ID.

This is my route.js file:

{
path: "/clip/:id?",
component: _548dcdc0,
name: "clip-id"
}, 

This is my nuxt link:

<div>
  <nuxt-link
  :to="{
  name: 'clip-id',
     params: {
       id: twItem.twId,
       slug: twItem.slug
     }
    }"
>
  {{ twItem.title }}</nuxt-link
>
</div>

And in mounted I have:

var self = this;
let id = this.$route.params.id;

self.slug = this.$route.params.slug;
console.log(self.slug);

I can get the id but slug is undefined here.

0

There are 0 best solutions below