1つのオプションは、変数にそれを結びつけることである。
data: function(){
return {
showModal: false
//starts as false. Set as true when modal opens. Set as false on close, which triggers the watch function.
},
watch: {
showModal: function(){
if(this.showModal == false){
// do something
},
}
HTML
<button id="show-modal" @click="showModal = true">Show Modal</button>
//later if using a component
<modal v-if="showModal" @close="showModal = false">
// or alternatively in the bootstrap structure
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" @click="showModal = false">Close</button>
</div>
この 'v-on:hide.bs.modal =" alert( 'hide')は 'hide.bs.modal'イベントをどこにも出さないので動作しません。すべてがVueのカスタムモーダルコンポーネントを作成するときに、Bootstrap jQueryモーダルで悩んでいます:) –