fix: close

This commit is contained in:
三咲智子 Kevin Deng 2023-08-01 17:39:02 +08:00
parent fcad412663
commit 9bc5c1c648
No known key found for this signature in database
GPG key ID: 69992F2250DFD93E

View file

@ -49,7 +49,7 @@ const props = withDefaults(defineProps<Props>(), {
const emit = defineEmits<{ const emit = defineEmits<{
/** v-model dialog visibility */ /** v-model dialog visibility */
(event: 'close',): void (event: 'close'): void
}>() }>()
const visible = defineModel<boolean>({ required: true }) const visible = defineModel<boolean>({ required: true })
@ -77,6 +77,8 @@ defineExpose({
/** close the dialog */ /** close the dialog */
function close() { function close() {
if (!visible.value)
return
visible.value = false visible.value = false
emit('close') emit('close')
} }