Skip to content

Commit

Permalink
fix: unable to prevent mask close for Modal and Drawer
Browse files Browse the repository at this point in the history
  • Loading branch information
qmhc committed Jun 7, 2022
1 parent 3186024 commit 332f286
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions components/drawer/drawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,9 @@ export default defineComponent({
return result
}
async function handleMaskClose() {
function handleMaskClose() {
if (props.maskClose) {
await handleClose()
return handleClose()
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/masker/masker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default defineComponent({
async function handleClose() {
if (!props.closable) return
let result = true
let result: unknown = true
if (typeof props.onBeforeClose === 'function') {
result = props.onBeforeClose()
Expand Down
12 changes: 6 additions & 6 deletions components/modal/modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ export default defineComponent({
const currentHeight = wrapper.value.offsetHeight
if (props.top === 'auto' && props.inner) {
let parentElement = wrapper.value.parentElement
let parentElement = wrapper.value.parentElement as HTMLElement
while (parentElement && parentElement !== document.body) {
if (getComputedStyle(parentElement).position !== 'static') {
Expand All @@ -315,7 +315,7 @@ export default defineComponent({
break
}
parentElement = parentElement.parentElement
parentElement = parentElement.parentElement as HTMLElement
}
} else {
currentTop.value =
Expand All @@ -331,7 +331,7 @@ export default defineComponent({
const currentWidth = wrapper.value.offsetWidth
if (props.left === 'auto' && props.inner) {
let parentElement = wrapper.value.parentElement
let parentElement = wrapper.value.parentElement as HTMLElement
while (parentElement && parentElement !== document.body) {
if (getComputedStyle(parentElement).position !== 'static') {
Expand All @@ -340,7 +340,7 @@ export default defineComponent({
break
}
parentElement = parentElement.parentElement
parentElement = parentElement.parentElement as HTMLElement
}
} else {
currentLeft.value =
Expand Down Expand Up @@ -389,9 +389,9 @@ export default defineComponent({
emit('hide')
}
async function handleMaskClose() {
function handleMaskClose() {
if (props.maskClose) {
await handleClose(false)
return handleClose(false)
}
}
Expand Down

0 comments on commit 332f286

Please sign in to comment.