I use vue-tables-2
and bootstrap-vue
. I've created a component which is a column in vue-tables-2
and it consists of button and modal code.
The problem is that this way, the modal is not opening when you click on the button and I don't know why.
EDIT
I found out that when I hardcode buttons attribute,it works. It just doesn't work when v-b-modal.modal-something
is generated by vue
.
This is a component:
Vue.component('vue-tables-2-product', {
delimiters: ['[[', ']]'],
props: ['data', 'index', 'column'],
template: `<div>
<b-modal v-bind="modal_attrs" title="BootstrapVue">
<p class="my-4">[[ this.data.name ]]</p>
</b-modal>
<b-button @click="log" v-bind="button_attrs">Detail</b-button></div>`,
methods: {
log: function () {
console.log(this.data)
}
},
computed: {
button_attrs() {
return {
[`v-b-modal.modal-${this.data.id}`]: "",
}
},
modal_attrs() {
return {
[`id`]: "modal-"+this.data.id,
}
},
}
})
And this is templates from the vue
app.
templates: {
on_stock: 'boolean',
is_active: 'boolean',
name: 'vue-tables-2-product',
import_export_price_diff: 'vue-tables-2-difference'
}
Do you know where is the problem?
EDIT:
I also tried to add this.$bvModal.show(this.data.id)
into the log
function and nothing happens.
I noticed that