Добавлен индикатор загрузки

This commit is contained in:
brusnitsyn
2026-06-02 14:23:51 +09:00
parent 339e4f5bb5
commit 6a4bbc301e

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { NFormItem, NCard, NScrollbar } from 'naive-ui' import { NFormItem, NCard, NScrollbar, NEl, NSpin } from 'naive-ui'
import {computed, ref, watch} from "vue"; import {computed, ref, watch} from "vue";
const props = defineProps({ const props = defineProps({
header: { header: {
@@ -25,6 +25,10 @@ const props = defineProps({
noPadding: { noPadding: {
type: Boolean, type: Boolean,
default: false default: false
},
loading: {
type: Boolean,
default: false
} }
}) })
@@ -61,7 +65,7 @@ watch(() => [props.minH, props.maxH], ([minH, maxH]) => {
<template> <template>
<NFormItem :show-label="hasHeaderInOutside" :label="header" :show-feedback="hasFeedback" :feedback="feedback"> <NFormItem :show-label="hasHeaderInOutside" :label="header" :show-feedback="hasFeedback" :feedback="feedback">
<NCard v-bind="$attrs" :class="noPadding ? 'no-padding h-full' : 'h-full'"> <NCard v-bind="$attrs" :class="noPadding ? 'no-padding h-full relative' : 'h-full relative'">
<template v-if="!hasHeaderInOutside && header" #header> <template v-if="!hasHeaderInOutside && header" #header>
{{ header }} {{ header }}
</template> </template>
@@ -71,6 +75,13 @@ watch(() => [props.minH, props.maxH], ([minH, maxH]) => {
<NScrollbar :style="styles"> <NScrollbar :style="styles">
<slot /> <slot />
</NScrollbar> </NScrollbar>
<div v-if="loading"
class="absolute inset-0 z-10" style="background-color: color-mix(in srgb, var(--n-color-popover) 20%, transparent)">
<div class="flex flex-col justify-center items-center h-full">
<NSpin size="small" />
</div>
</div>
</NCard> </NCard>
</NFormItem> </NFormItem>
</template> </template>