Search code examples
vue.jsurlhyperlinknuxt.jsnuxt-link

How to use NuxtLink and send data through pages


I am facing a problem with Nuxt Link:

-First i make a v-for to build some html

   <li v-for="loja in lojas">
        <p>{{loja.nomeEmpresa}}</p>
        <p> {{loja.url}} </p>
        <NuxtLink :to="nextPage">Configurar</NuxtLink>
        <b-button>Visualizar</b-button>
   </li>

This object loja have {url,id}

So, my problem is: How to use NuxLink and pass this id to my next page?

My idea is something like, that does not work:

       <NuxtLink :to="nextPage?usuarioId=${{loja.id}}">Configurar</NuxtLink>

Anyone know how to?


Solution

  • Use a template literal, like:

    <NuxtLink :to="`nextPage?usuarioId=${loja.id}`">Configurar</NuxtLink>