fix: 修复使用useVbenVxeGrid配置hasEmptyText、hasEmptyRender不生效的问题 (#6310)

This commit is contained in:
wyc001122 2025-06-02 08:16:26 +08:00 committed by GitHub
parent 76d106e474
commit 470fd43b49
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -278,6 +278,15 @@ const delegatedFormSlots = computed(() => {
return resultSlots.map((key) => key.replace(FORM_SLOT_PREFIX, '')); return resultSlots.map((key) => key.replace(FORM_SLOT_PREFIX, ''));
}); });
const showDefaultEmpty = computed(() => {
// VXE Table
const hasEmptyText = options.value.emptyText !== undefined;
const hasEmptyRender = options.value.emptyRender !== undefined;
//
return !hasEmptyText && !hasEmptyRender;
});
async function init() { async function init() {
await nextTick(); await nextTick();
const globalGridConfig = VxeUI?.getConfig()?.grid ?? {}; const globalGridConfig = VxeUI?.getConfig()?.grid ?? {};
@ -459,7 +468,7 @@ onUnmounted(() => {
</slot> </slot>
</template> </template>
<!-- 统一控状态 --> <!-- 统一控状态 -->
<template #empty> <template v-if="showDefaultEmpty" #empty>
<slot name="empty"> <slot name="empty">
<EmptyIcon class="mx-auto" /> <EmptyIcon class="mx-auto" />
<div class="mt-2">{{ $t('common.noData') }}</div> <div class="mt-2">{{ $t('common.noData') }}</div>