Answer the question
In order to leave comments, you need to log in
How to add a variable to the href link attribute in vue js?
I do something like this:
<span> Вы получили предложение от пользователя <a href="users/{{ item.slug }}">{{ item.name }}</a></span>
${ item.slug }
it, not the same. How to pass a variable there?
Answer the question
In order to leave comments, you need to log in
Tag attributes must be constructed using v-bind (v-bind:href or :href).
If an object is used inside quotes, then it is perceived as an attribute selector, if a string, then the string is glued together in the final value of the attribute.
<span> Вы получили предложение от пользователя <a v-bind:href="'users/' + item.slug">{{ item.name }}</a></span>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question