0๐
โ
I found the problem. I changed the mounted
hook to:
mounted: function() {
let _this = this;
$(`#${this.randomID}`).on('hide.bs.modal', function(e) {
_this.$emit('modal-close')
})
}
It was probably a scope problem. which has been solved by:
- Declaring the "instance copy" (
_this
) withlet
. - Changing the callback function from the JQuery listener declaration from arrow function to a normal function.
It still feels quite strange because the event was being emitted, but that was probably because I also had an instance = this
on my bootstrap-table
component which was being globally scoped (ร was not using let
either).
Source:stackexchange.com