diff --git a/web/views/IniImportForm.vue b/web/views/IniImportForm.vue index af34aa8..a67b7f2 100644 --- a/web/views/IniImportForm.vue +++ b/web/views/IniImportForm.vue @@ -90,6 +90,16 @@ function submit() { emit('submit', plan.value) } +/** + * Esc 关弹窗走这里。文件选择框被取消时 input 的 cancel 事件会冒泡到 dialog, + * 不是发给 dialog 自己的一律不理——否则取消选文件会把整个弹窗带关。 + */ +function onCancel(event: Event) { + if (event.target !== dialog.value) return + event.preventDefault() + emit('close') +} + /** 点在遮罩上就关闭。内容区的点击 target 是 form 里的元素,到不了 dialog 本身。 */ function onBackdrop(event: MouseEvent) { if (event.target === dialog.value) emit('close') @@ -102,7 +112,7 @@ function onBackdrop(event: MouseEvent) { class="dlg" @click="onBackdrop" @close="emit('close')" - @cancel.prevent="emit('close')" + @cancel="onCancel" >