Search code examples
javascriptvue.jsnuxt.jsstrapi

dynamique nuxt-link with strapi


I think I understand that strapi + the nuxt-link tag allows you to make dynamically link to another view without methods.
I need a link for a vue with the id in parameter to received the good data on the url of strapi.
Actually i try that:

<li v-for="app in applications" :key="app.id">
  <nuxt-link to=`/applications/${app.id}`>
    {{ app.name }}
  </nuxt-link>
</li>

But my syntaxe is not correct, i have this error:

ERROR in ./components/TheSidebar.vue
  6:23  error    Parsing error: unexpected-character-in-unquoted-attribute-value  vue/no-parsing-error
  6:23  warning  Expected to be enclosed by double quotes                         vue/html-quotes
  6:24  error    Parsing error: unexpected-character-in-unquoted-attribute-value  vue/no-parsing-error
  6:38  error    Parsing error: unexpected-character-in-unquoted-attribute-value  vue/no-parsing-error

How can i make this dynamique link please?


Solution

  • This should work, tags should not be opened/closed with ``, but always with double quotes ("")

    <li v-for="app in applications" :key="app.id">
       <nuxt-link :to="'/applications/' + app.id">
          {{ app.name }}
       </nuxt-link>
    </li>