Skip to content

Commit 470fd43

Browse files
authored
fix: 修复使用useVbenVxeGrid配置hasEmptyText、hasEmptyRender不生效的问题 (vbenjs#6310)
1 parent 76d106e commit 470fd43

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/effects/plugins/src/vxe-table/use-vxe-grid.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,15 @@ const delegatedFormSlots = computed(() => {
278278
return resultSlots.map((key) => key.replace(FORM_SLOT_PREFIX, ''));
279279
});
280280
281+
const showDefaultEmpty = computed(() => {
282+
// 检查是否有原生的 VXE Table 空状态配置
283+
const hasEmptyText = options.value.emptyText !== undefined;
284+
const hasEmptyRender = options.value.emptyRender !== undefined;
285+
286+
// 如果有原生配置,就不显示默认的空状态
287+
return !hasEmptyText && !hasEmptyRender;
288+
});
289+
281290
async function init() {
282291
await nextTick();
283292
const globalGridConfig = VxeUI?.getConfig()?.grid ?? {};
@@ -459,7 +468,7 @@ onUnmounted(() => {
459468
</slot>
460469
</template>
461470
<!-- 统一控状态 -->
462-
<template #empty>
471+
<template v-if="showDefaultEmpty" #empty>
463472
<slot name="empty">
464473
<EmptyIcon class="mx-auto" />
465474
<div class="mt-2">{{ $t('common.noData') }}</div>

0 commit comments

Comments
 (0)