update: 字典loading

This commit is contained in:
dap 2025-04-07 17:20:41 +08:00
parent 5b72d9b79d
commit 92fe406ae9
2 changed files with 13 additions and 2 deletions

View File

@ -4,7 +4,7 @@ import type { DictData } from '#/api/system/dict/dict-data-model';
import { computed } from 'vue';
import { Tag } from 'ant-design-vue';
import { Spin, Tag } from 'ant-design-vue';
import { tagTypes } from './data';
@ -41,12 +41,22 @@ const label = computed<number | string>(() => {
});
const tagComponent = computed(() => (color.value ? Tag : 'div'));
const loading = computed(() => {
return props.dicts?.length === 0;
});
</script>
<template>
<div>
<component :is="tagComponent" :class="cssClass" :color="color">
<component
v-if="!loading"
:is="tagComponent"
:class="`${cssClass} enter-x`"
:color="color"
>
{{ label }}
</component>
<Spin v-else :spinning="true" size="small" />
</div>
</template>

View File

@ -59,6 +59,7 @@ export const useDictStore = defineStore('app-dict', () => {
}
function resetCache() {
dictRequestCache.clear();
dictOptionsMap.clear();
/**
* dictRequestCache /key