我试图将我从v-for获取的值附加到同一标签中的属性但没有运气。这是我的代码:
<label
v-for="hashtag in hashtags"
v-bind:title=`You can filter with {hashtag}`
v-bind:data-value="hashtag"
></label>
基本上,该值会转到title
和data-value
答案 0 :(得分:3)
你的标题绑定应该在表达式之前和之后有双引号,并且你似乎想在标题中插入字符串,但我认为它不会起作用。
试试这个(你可以省略v-bind cus :
这是它的简写)
<label v-for="hashtag in hashtags" :title="'You can filter with ' + hashtag" :data-value="hashtag">
{{ hashtag }}
</label>