Skip to content

Commit c42962b

Browse files
committed
Merge branch 'dev'
2 parents 7622006 + 10fcfdd commit c42962b

File tree

6 files changed

+17
-7
lines changed

6 files changed

+17
-7
lines changed

dist/VueFinalModal.esm.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/VueFinalModal.esm.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/VueFinalModal.umd.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/VueFinalModal.umd.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/PluginCore.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ function createVfm() {
2525
get(name) {
2626
return this.modals.find(modal => modal.name === name)
2727
},
28-
get openedModals() {
29-
return this.modals.filter(modal => modal.value)
30-
},
28+
openedModals: [],
3129
modals: []
3230
}
3331
return vfm

lib/VueFinalModal.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,13 @@ export default {
194194
if (target || this.attach === false) {
195195
this.attach !== false && target.appendChild(this.$el)
196196
197+
let index = this.api.openedModals.findIndex(vm => vm === this)
198+
if (index !== -1) {
199+
// if this is already exist in modalStack, delete it
200+
this.api.openedModals.splice(index, 1)
201+
}
202+
this.api.openedModals.push(this)
203+
197204
this.modalStackIndex = this.api.openedModals.length - 1
198205
199206
this.handleLockScroll()
@@ -217,6 +224,11 @@ export default {
217224
}
218225
},
219226
close() {
227+
let index = this.api.openedModals.findIndex(vm => vm === this)
228+
if (index !== -1) {
229+
// remove this in modalStack
230+
this.api.openedModals.splice(index, 1)
231+
}
220232
if (this.api.openedModals.length > 0) {
221233
// If there are still nested modals opened
222234
const $_vm = this.api.openedModals[this.api.openedModals.length - 1]

0 commit comments

Comments
 (0)