How to use a vue array inside a quote?

Asked by At

I was trying to access a vue array inside a quote like this

<div v-for="category in categories">
        <a href="{{}}">Links</a>

its doesnt seem to work. Then i tried taking the code out of the quote<a href="">{{}}</a> this works fine . Is there any other way to do this?


2 Answers

Community On Best Solutions

You must bind your attributes when they are from Vue variables.

<div v-for="category in categories">
    <a :href="">Link</a>
Begueradj On

You can not pass an array of links as a value of the href attribute. You can pass one link at the same time, instead.

On the other hand, if we suppose refers to one link only, then you can write this:

<a href="">Link</a>