Multiple dynamic ids in v-b-toggle
See original GitHub issueHey 😃,
I cannot find how to add multiple dynamically created ids into directive v-b-toggle
. I’ve found a solution just for a single dynamic id.
I’ve tried this, but none of this works:
v-b-toggle="`id-${name1} id-${name2} id-${name3}`"
v-b-toggle="`id-${name1}.id-${name2}.id-${name3}`"
v-b-toggle="{[`id-${name1}`]: true, [`id-${name2}`]: true, [`id-${name3}`]: true}"
Is there any way how to do it and set more than one modifier dynamically?
The whole problem in short:
<template>
<div class="super-ultra-toggler">
<b-button v-b-toggle="{[`id-${name1}`]: true, [`id-${name2}`]: true, [`id-${name3}`]: true}">toggle all</b-button>
<div v-for="(name, index) in names"
:key="`name-${index}`">
<b-button v-b-toggle="`id-${name}`">toggle</b-button>
<b-collapse :id="`id-${name}`" :visible="false">
<p>{{ name }}</p>
</b-collapse>
</div>
</div>
</template>
<script>
export default {
name: 'UltraSuperToggler',
data() {
return {
name1: 'Bob',
name2: 'Mark',
name3: 'Lea',
names: ['Bob', 'Mark', 'Lea']
}
}
}
</script>
Issue Analytics
- State:
- Created 4 years ago
- Comments:18 (9 by maintainers)
Top Results From Across the Web
Dynamically generating directive name in Vue Bootstrap
The way Vue bootstrap does this is by giving the collapsable element an id that matches up to the directive name of the...
Read more >Toggle | Directives
v-b -toggle is a light-weight directive for toggling the visibility of collapses and sidebars, and includes automated WAI-ARIA accessibility attribute handling.
Read more >Show / hide columns dynamically
Name Position Office Age Start date Salary
Airi Satou Accountant Tokyo 33 2008‑11‑28 $162,700
Angelica Ramos Chief Executive Officer (CEO) London 47 2009‑10‑09 $1,200,000
Ashton Cox...
Read more >Dynamic Components with Vue's 'component'
Dynamic Components with Vue's 'component' ... piece of your template could be dynamic and switch between one or many components depending on ...
Read more >Handling Web Tables, Frames, and Dynamic Elements in ...
There are many ways we can handle a web table. ... For example: if id of 'login' field changes dynamically and there is...
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
Alternatively to the v-model solution you could create a method which takes an array of id’s as a parameter and use the option to emit on root, by looping through the passed in ID’s and emitting for each of them.
I just tested in the playground, and it works fine for me: https://codesandbox.io/s/little-pond-hnfci