Dynamic property for v-b-toggle
See original GitHub issueWhen dynamically building an accordion with a for-loop, we need to
<b-btn block href="#" v-b-toggle.accordion1 variant="info">Accordion 1</b-btn>
But v-b-toggle.accordion1
can not be constructed dynamically, can it? Would :v-b-toggle="'#accordion' + index"
have been more logical? Or am I missing something ? … ))
Issue Analytics
- State:
- Created 6 years ago
- Comments:20 (2 by maintainers)
Top Results From Across the Web
Toggle | Directives - BootstrapVue
v-b -toggle is a light-weight directive for toggling the visibility of collapses and sidebars, and includes automated WAI-ARIA accessibility attribute ...
Read more >Dynamically generating directive name in Vue Bootstrap
I would like to be able to give the dropdown item a directive like v-b-toggle="'collapse' + {{index}}" rather than hardcoding it like I've ......
Read more >Accessing Dynamic Properties in LabVIEW - NI
To access dynamic properties of an object, you must first use the AsPropertyObject method of the object to convert the specific object reference ......
Read more >Toggle CSS class for dynamical data with method-Vue.js
to make the class changes dynamically you should add a property called descShown to your projects array. in getProject action inside your store...
Read more >Dynamic Block Functions | Lee Mac Programming
A set of Visual LISP functions for manipulating dynamic block properties. ... Toggle Dynamic Block Flip State - Lee Mac ;; Toggles the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
v-b-toggle
does accept a dynamic value to specify a single target ID. Not do not include the#
as it doesn’t accept a CSS selector. just pass the plain id as a string (note it must be a string, and ID’s are not allowed to start with a digit):Note here is no
#
in front of the generated IDI know this is closed but this might help other who need a “dynamic id”. I am doing an api call and creating the accordion based on the returned results. I also created a function to filter results based on a title so I can make one call but create separate accordions.
<div id="app"> <div role="tablist"> <b-card no-body class="mb-1" v-for="(faq, index) in filteredTraffic"> <b-card-header header-tag="header" class="p-1" role="tab"> <b-btn block href="#" v-b-toggle="'accordion'+index" variant="info">{{faq.question}}</b-btn> </b-card-header> <b-collapse v-bind:id="'accordion'+index" accordion="my-accordion" role="tabpanel"> <b-card-body> <p class="card-text"> {{faq.answer}} <br> <a v-if="faq.links !==null" :href="faq.links.Url">{{faq.links.Description}}</a> </p> </b-card-body> </b-collapse> </b-card> </div> </div>
I hope this helps.