Skip to content

Commit 0f2d624

Browse files
committed
fix #259
1 parent 3c80276 commit 0f2d624

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/App.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,10 +1161,9 @@
11611161
<h2>Modal</h2>
11621162
<b-button @click="showModal = !showModal"> Toggle modal v-model </b-button>
11631163
{{ showModal }}
1164-
<!-- <b-button v-b-modal:exampleModal>Launch demo modal</b-button> -->
1165-
<b-modal id="exampleModal" v-model="showModal" size="xl" title="Modal title" fade>
1166-
...
1167-
</b-modal>
1164+
<b-button v-b-modal="'exampleModal'">Launch demo modal (value)</b-button>
1165+
<b-button v-b-modal.exampleModal>Launch demo modal </b-button>
1166+
<b-modal id="exampleModal" size="xl" title="Modal title" fade> ... </b-modal>
11681167
</div>
11691168

11701169
<!-- <b-nav pills>

src/directives/BModal.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ import {DirectiveBinding} from 'vue'
22

33
export default {
44
mounted(el: HTMLElement, binding: DirectiveBinding): void {
5+
let target: string = binding.value
6+
7+
if (Object.keys(binding.modifiers).length > 0) {
8+
;[target] = Object.keys(binding.modifiers)
9+
}
10+
511
el.setAttribute('data-bs-toggle', 'modal')
6-
el.setAttribute('data-bs-target', `#${binding.arg}`)
12+
el.setAttribute('data-bs-target', `#${target}`)
713
},
814
}

0 commit comments

Comments
 (0)