refactor: 使用 Naive UI 重构后台布局与黑白双主题
This commit is contained in:
1 parent
55516537bf
commit
db8c176b55
51 files changed
+3277
-2442
No files matched your search
@@ -1,44 +1,26 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
DialogRoot,
|
||||
DialogPortal,
|
||||
DialogOverlay,
|
||||
DialogContent,
|
||||
DialogTitle,
|
||||
DialogDescription,
|
||||
DialogClose
|
||||
} from 'reka-ui'
|
||||
import { X } from '@lucide/vue'
|
||||
|
||||
/** 统一弹窗容器,Reka UI 负责焦点锁定、Escape 和无障碍语义。 */
|
||||
import { NModal, NScrollbar } from 'naive-ui'
|
||||
/** Naive UI 管理焦点锁定、Esc、遮罩与主题;长弹窗只滚动内部正文。 */
|
||||
defineProps<{ title: string; description: string; busy?: boolean; wide?: boolean }>()
|
||||
const open = defineModel<boolean>('open', { default: false })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DialogRoot v-model:open="open">
|
||||
<slot name="trigger"></slot>
|
||||
<DialogPortal>
|
||||
<DialogOverlay class="dialog-overlay" />
|
||||
<DialogContent
|
||||
class="dialog-content"
|
||||
:class="{ 'dialog-wide': wide }"
|
||||
@interact-outside="busy && $event.preventDefault()"
|
||||
@escape-key-down="busy && $event.preventDefault()"
|
||||
>
|
||||
<div class="flex items-start justify-between gap-4">
|
||||
<div>
|
||||
<DialogTitle class="text-xl font-semibold">{{ title }}</DialogTitle
|
||||
><DialogDescription class="mt-2 text-sm leading-6 text-muted">{{
|
||||
description
|
||||
}}</DialogDescription>
|
||||
</div>
|
||||
<DialogClose class="icon-button shrink-0" aria-label="关闭弹窗" :disabled="busy"
|
||||
><X :size="18"
|
||||
/></DialogClose>
|
||||
</div>
|
||||
<slot></slot>
|
||||
</DialogContent>
|
||||
</DialogPortal>
|
||||
</DialogRoot>
|
||||
<slot name="trigger" />
|
||||
<NModal
|
||||
v-model:show="open"
|
||||
preset="card"
|
||||
:title="title"
|
||||
:closable="!busy"
|
||||
:mask-closable="!busy"
|
||||
:close-on-esc="!busy"
|
||||
:style="{ width: wide ? '1040px' : '600px' }"
|
||||
class="app-dialog"
|
||||
role="dialog"
|
||||
:aria-label="title"
|
||||
>
|
||||
<NScrollbar class="dialog-body-scroll">
|
||||
<p class="text-sm leading-6 text-muted">{{ description }}</p>
|
||||
<slot />
|
||||
</NScrollbar>
|
||||
</NModal>
|
||||
</template>
|
||||
Reference in new issue
Block a user