vue.js 如何在Bootstrap数据目标中正确传递$index?

0pizxfdo  于 2022-11-25  发布在  Vue.js
关注(0)|答案(1)|浏览(99)

我使用v-for index创建了动态id,问题是当我尝试使用Bootstrap的data-target链接div时
这不起作用:

<button data-toggle="collapse" data-target="'#demo'+{{$index}}">EXPAND</button> 

<div v-bind:id="['demo'+index]" class="collapse">
    {{service.sotto[index]}}
</div>

那么如何正确使用数据目标+索引呢?

kqlmhetl

kqlmhetl1#

找到了!

:data-target="'#demo' + index"

相关问题