I have a collapse that is inside of Vue container. now, the hidden.bs.collapse event of bootstrap doesn't work anymore.
I saw a solution that needs to add a ref="" and include it in the mounted However the problem is that the condition inside of hidden.bs.collapse is automatically called even though the event is not yet called.
here's the code..
methods: {
test(){
console.log('test function')
$('#form_create')[0].reset();
$(".alert").alert('close')
$('input,textarea').removeClass('is-invalid')
},
test2(){
console.log('1321');
}
},
mounted() {
$(this.$refs.createForm).on('hidden.bs.collapse', this.test());
$(this.$refs.showForm).on('hidden.bs.collapse', this.test2());
}
EDIT:
silly me. the 2nd parameter of the on shouldn't have ().
$(this.$refs.createForm).on('hidden.bs.collapse', this.test);