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" >
diff --git a/web/views/RuleGroupForm.vue b/web/views/RuleGroupForm.vue index ed7bd70..c7d3ed7 100644 --- a/web/views/RuleGroupForm.vue +++ b/web/views/RuleGroupForm.vue @@ -112,6 +112,16 @@ function submit() { }) } +/** + * 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') @@ -124,7 +134,7 @@ function onBackdrop(event: MouseEvent) { class="dlg" @click="onBackdrop" @close="emit('close')" - @cancel.prevent="emit('close')" + @cancel="onCancel" >
diff --git a/web/views/SubscriptionForm.vue b/web/views/SubscriptionForm.vue index 828ca11..8eb7a43 100644 --- a/web/views/SubscriptionForm.vue +++ b/web/views/SubscriptionForm.vue @@ -99,6 +99,16 @@ function submit() { }) } +/** + * 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') @@ -111,7 +121,7 @@ function onBackdrop(event: MouseEvent) { class="dlg" @click="onBackdrop" @close="emit('close')" - @cancel.prevent="emit('close')" + @cancel="onCancel" >