Fixed bug where state function argument was not considered (#5)

This commit is contained in:
euvl
2017-04-15 20:58:36 +01:00
parent eead3bc770
commit 5d8cd805db
2 changed files with 10 additions and 2 deletions

View File

@@ -137,7 +137,11 @@
created () {
Modal.event.$on('toggle', (name, state, params) => {
if (name === this.name) {
this.toggle(!this.visible, params)
if (typeof state === 'undefined') {
state = !this.visible
}
this.toggle(state, params)
}
});
@@ -216,7 +220,7 @@
if (!stopEventExecution) {
const afterEvent = this.genEventObject({ state, params })
this.visible = !!state
this.visible = state
this.$emit(afterEventName, afterEvent)
}
},

View File

@@ -13,6 +13,10 @@ const ModalPlugin = {
hide(name, params) {
ModalPlugin.event.$emit('toggle', name, false, params)
},
toggle(name, params) {
ModalPlugin.event.$emit('toggle', name, undefined, params)
}
}