我是Bootstrap-Vue和Vue的新手。 我正在尝试使用Animate.css创建具有某些动画效果的b模态。我指的是这个Custom-Transition-Classes。
我的代码是这样的:
<transition name="modal1" enter-active-class="animated slideInLeft" leave-
active-class="animated slideOutLeft">
<b-modal ref="saveModal" transition id="modal1" title="Save"
@ok="handleOk" @cancel="handleCancel">
<p class="my-4">Are you sure, you want to save?.</p>
</b-modal>
</transition>
答案 0 :(得分:0)
引导Vue的模态动画似乎与过渡不兼容。一些简单的解决方法似乎是简单地在shown
ok
或cancel
事件(https://bootstrap-vue.js.org/docs/components/modal/参见最后一部分)上手动添加动画类名称,如下所示:>
https://jsfiddle.net/Sirence/g8w2d413/33/
methods: {
shown: function(){
let modal = document.getElementById('modal1');
modal.parentElement.parentElement.classList.remove('hidden');
modal.classList.add('slideInLeft');
modal.classList.add('animated');
},
hidden: function(evt) {
let modal = document.getElementById('modal1');
evt.preventDefault();
modal.classList.add('slideOutLeft');
setTimeout(() => {
this.$refs.myModalRef.hide();
modal.parentElement.parentElement.classList.add('hidden');
console.log('test');
}, 1000)
}
}
.hidden {
display: none;
}
<b-btn v-b-modal.modal1>Launch demo modal</b-btn>
<b-modal ref="myModalRef" id="modal1" title="Bootstrap-Vue" @shown="shown" no-fade class="hidden" @ok="hidden" @cancel="hidden">
<p class="my-4">Hello from modal!</p>
</b-modal>