refactor: 弹窗正文统一使用 NScrollbar

This commit is contained in:
GouJ committed 2026-09-26 23:22:25 +08:00
1 parent 21ba1ec001
commit 1b1091ee45
1 file changed
+5 -12
+5 -12
View File
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { NModal } from 'naive-ui' import { NModal, NScrollbar } from 'naive-ui'
/** Naive UI 管理焦点锁定、Esc、遮罩与主题;长弹窗只滚动内部正文。 */ /** Naive UI 管理焦点锁定、Esc、遮罩与主题;长弹窗只滚动内部正文。 */
defineProps<{ title: string; description: string; busy?: boolean; wide?: boolean }>() defineProps<{ title: string; description: string; busy?: boolean; wide?: boolean }>()
const open = defineModel<boolean>('open', { default: false }) const open = defineModel<boolean>('open', { default: false })
@@ -18,10 +18,10 @@ const open = defineModel<boolean>('open', { default: false })
role="dialog" role="dialog"
:aria-label="title" :aria-label="title"
> >
<div class="dialog-body-scroll"> <NScrollbar class="dialog-body-scroll" trigger="none">
<p class="text-sm leading-6 text-muted">{{ description }}</p> <p class="text-sm leading-6 text-muted">{{ description }}</p>
<slot /> <slot />
</div> </NScrollbar>
<template v-if="$slots.footer" #footer> <template v-if="$slots.footer" #footer>
<div class="dialog-footer"><slot name="footer" /></div> <div class="dialog-footer"><slot name="footer" /></div>
</template> </template>
@@ -41,15 +41,8 @@ const open = defineModel<boolean>('open', { default: false })
.app-dialog .n-card-header { .app-dialog .n-card-header {
@apply shrink-0; @apply shrink-0;
} }
.dialog-body-scroll { .dialog-body-scroll.n-scrollbar {
@apply min-h-0 overflow-y-auto; @apply min-h-0 h-full;
scrollbar-width: none !important;
-ms-overflow-style: none;
}
.app-dialog .dialog-body-scroll::-webkit-scrollbar {
width: 0 !important;
height: 0 !important;
display: none !important;
} }
.app-dialog .n-card__content { .app-dialog .n-card__content {
@apply min-h-0 flex-1 overflow-hidden; @apply min-h-0 flex-1 overflow-hidden;