1111
This commit is contained in:
@@ -109,6 +109,22 @@ function closeForm() {
|
||||
formOpen.value = false
|
||||
}
|
||||
|
||||
let backdropPressed = false
|
||||
|
||||
function onBackdropPointerDown(event: PointerEvent) {
|
||||
backdropPressed = event.target === event.currentTarget
|
||||
}
|
||||
|
||||
function onBackdropPointerUp(event: PointerEvent) {
|
||||
if (event.target !== event.currentTarget) backdropPressed = false
|
||||
}
|
||||
|
||||
function closeOnBackdrop(event: MouseEvent, action: () => void) {
|
||||
const shouldClose = backdropPressed && event.target === event.currentTarget
|
||||
backdropPressed = false
|
||||
if (shouldClose) action()
|
||||
}
|
||||
|
||||
async function save() {
|
||||
if (saving.value) return
|
||||
|
||||
@@ -254,7 +270,13 @@ onMounted(() => {
|
||||
|
||||
<Teleport to="body">
|
||||
<Transition name="config-modal">
|
||||
<div v-if="formOpen" class="config-backdrop" @click.self="closeForm">
|
||||
<div
|
||||
v-if="formOpen"
|
||||
class="config-backdrop"
|
||||
@pointerdown="onBackdropPointerDown"
|
||||
@pointerup="onBackdropPointerUp"
|
||||
@click="closeOnBackdrop($event, closeForm)"
|
||||
>
|
||||
<section class="form-card" role="dialog" aria-modal="true" aria-label="系统参数表单">
|
||||
<h2>{{ editingId === null ? '新增系统参数' : '编辑系统参数' }}</h2>
|
||||
|
||||
@@ -316,7 +338,13 @@ onMounted(() => {
|
||||
|
||||
<Teleport to="body">
|
||||
<Transition name="config-modal">
|
||||
<div v-if="deleting" class="config-backdrop" @click.self="cancelDelete">
|
||||
<div
|
||||
v-if="deleting"
|
||||
class="config-backdrop"
|
||||
@pointerdown="onBackdropPointerDown"
|
||||
@pointerup="onBackdropPointerUp"
|
||||
@click="closeOnBackdrop($event, cancelDelete)"
|
||||
>
|
||||
<section class="confirm-card" role="dialog" aria-modal="true" aria-label="删除确认">
|
||||
<h2>删除系统参数</h2>
|
||||
<p>
|
||||
|
||||
Reference in New Issue
Block a user