Skip to content

Commit 0a2fb6b

Browse files
committed
fix: Various model-mixin fixes
1 parent 06683e7 commit 0a2fb6b

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

src/components/modal/QModal.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,14 @@ export default {
172172

173173
EscapeKey.pop()
174174
openedModalNumber--
175-
this.__updateModel(false)
176175

177176
if (openedModalNumber === 0) {
178177
const body = document.body
179178
body.classList.remove('with-modal')
180179
body.style.paddingRight = this.bodyPadding
181180
}
182181

182+
this.__updateModel(false)
183183
return new Promise((resolve, reject) => {
184184
setTimeout(() => {
185185
this.$emit('hide')
@@ -227,11 +227,9 @@ export default {
227227
on: {
228228
mousedown (e) {
229229
e.stopPropagation()
230-
e.preventDefault()
231230
},
232231
touchstart (e) {
233232
e.stopPropagation()
234-
e.preventDefault()
235233
}
236234
}
237235
}, [ this.$slots.default ])

src/mixins/model-toggle.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,9 @@ export default {
1010
}
1111
},
1212
watch: {
13-
value: {
14-
handler (val) {
15-
this.$nextTick(() => {
16-
if (val) { this.show() }
17-
else { this.hide() }
18-
})
19-
},
20-
immediate: true
13+
value (val) {
14+
if (val) { this.show() }
15+
else { this.hide() }
2116
}
2217
},
2318
methods: {
@@ -28,7 +23,7 @@ export default {
2823
if (this.showing !== val) {
2924
this.showing = val
3025

31-
if (noHistory) {
26+
if (noHistory !== void 0) {
3227
// do nothing
3328
}
3429
else if (val) {
@@ -46,5 +41,10 @@ export default {
4641
this.$emit('input', val)
4742
}
4843
}
44+
},
45+
mounted () {
46+
if (this.value) {
47+
this.show()
48+
}
4949
}
5050
}

0 commit comments

Comments
 (0)