From fff0732bcb19f1f0cef51391d9c9cbfbb590b04b Mon Sep 17 00:00:00 2001 From: Anton Date: Fri, 26 May 2017 00:39:05 +0300 Subject: [PATCH 1/2] modal: change event order --- lib/components/modal.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/components/modal.vue b/lib/components/modal.vue index 6c9a8f7015d..3513d4e02cf 100755 --- a/lib/components/modal.vue +++ b/lib/components/modal.vue @@ -214,16 +214,16 @@ } }; - // Emit events - this.$emit('change', false); - this.$emit('hidden', e); - + // Emit `ok` and `cancel` events if (isOK === true) { this.$emit('ok', e); } else if (isOK === false) { this.$emit('cancel', e); } + // Call `change` event after we know what we did + this.$emit('change', false); + // Hide if not canceled if (!canceled) { if (typeof document !== 'undefined') { @@ -234,6 +234,7 @@ } this.is_visible = false; this.$root.$emit('hidden::modal', this.id); + this.$emit('hidden', e); this.body.classList.remove('modal-open'); } }, From 971046819de088bb158591b7bfaeb30a1644e3bd Mon Sep 17 00:00:00 2001 From: Anton Date: Fri, 26 May 2017 01:03:09 +0300 Subject: [PATCH 2/2] modal: change to BS4 events --- lib/components/modal.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/components/modal.vue b/lib/components/modal.vue index 3513d4e02cf..a752d45b28f 100755 --- a/lib/components/modal.vue +++ b/lib/components/modal.vue @@ -188,6 +188,7 @@ if (this.is_visible) { return; } + this.$emit('show'); this.is_visible = true; this.$root.$emit('shown::modal', this.id); this.body.classList.add('modal-open'); @@ -214,16 +215,16 @@ } }; - // Emit `ok` and `cancel` events + // Emit events + this.$emit('change', false); + this.$emit('hide',e); + if (isOK === true) { this.$emit('ok', e); } else if (isOK === false) { this.$emit('cancel', e); } - // Call `change` event after we know what we did - this.$emit('change', false); - // Hide if not canceled if (!canceled) { if (typeof document !== 'undefined') {