0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Vue-Bootstrapで動的にCollapseを生成する

Last updated at Posted at 2022-01-07

##経緯
とあるサイト制作でtemplateを使用してボタンで発火するv-collapseをたくさん用意したかったのだが、idを動的にbindしてもうまく動かなかった

##解決方法

main_card.vue
<b-button v-on:click="expandcoll" variant="outline-info" :id="'btn'+collapseid"
  >Member</b-button
>

<b-collapse :visible="isexpand" class="mt-2">
  <!-- dosomething -->
</b-collapse>

idなんてもので制御するのではなく、<b-collapse :visible="bool">を指定してあげれば、ボタンでboolの値を変更するだけで簡単に制御することが出来た。
bootstrapのリファレンスにこだわりすぎた。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?