feat: 表单弹窗固定操作区并隐藏滚动条

This commit is contained in:
GouJ committed 2026-09-26 23:09:47 +08:00
1 parent f098d579ca
commit 1a53259322
1 file changed
+19 -8
+19 -8
View File
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { NModal, NScrollbar } from 'naive-ui' import { NModal } 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"
> >
<NScrollbar class="dialog-body-scroll"> <div class="dialog-body-scroll">
<p class="text-sm leading-6 text-muted">{{ description }}</p> <p class="text-sm leading-6 text-muted">{{ description }}</p>
<slot /> <slot />
</NScrollbar> </div>
</NModal> </NModal>
</template> </template>
@@ -33,18 +33,29 @@ const open = defineModel<boolean>('open', { default: false })
--app-field-hover: var(--app-control-hover); --app-field-hover: var(--app-control-hover);
} }
.app-dialog { .app-dialog {
@apply max-w-[calc(100vw-32px)] max-h-[calc(100dvh-32px)]; @apply max-w-[calc(100vw-32px)] max-h-[calc(100dvh-32px)] flex flex-col;
} }
.app-dialog .n-card-header { .app-dialog .n-card-header {
@apply shrink-0; @apply shrink-0;
} }
.dialog-body-scroll { .dialog-body-scroll {
@apply max-h-[calc(100dvh-154px)]; @apply min-h-0 overflow-y-auto;
scrollbar-width: none;
}
.dialog-body-scroll::-webkit-scrollbar {
display: none;
} }
.app-dialog .n-card__content { .app-dialog .n-card__content {
@apply min-h-0; @apply min-h-0 flex-1 overflow-hidden;
} }
.app-dialog .dialog-body-scroll > .n-scrollbar-container > .n-scrollbar-content { .app-dialog .n-card-header__close {
@apply px-0; @apply grid place-items-center w-10 h-10 -m-2 rounded-none;
}
.app-dialog .n-card-header__close:hover {
@apply bg-(--app-subtle);
}
.app-dialog .dialog-footer {
@apply sticky bottom-0 z-10 py-4 bg-(--app-surface);
box-shadow: 0 -1px var(--app-border);
} }
</style> </style>