From 2678b5e3586e84ac79fcb0d2ccebc85fe9527e12 Mon Sep 17 00:00:00 2001
From: Leo <98382335+gaoziman@users.noreply.github.com>
Date: Mon, 7 Jul 2025 22:35:23 +0800
Subject: [PATCH] =?UTF-8?q?fix(component):=20=E4=BF=AE=E5=A4=8DCoiEmpty?=
=?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=9B=BE=E6=A0=87=E6=98=BE=E7=A4=BA=E9=97=AE?=
=?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 移除动态组件引用,直接使用icon-park-outline图标组件
- 优化图标显示逻辑,根据不同类型显示对应图标
- 移除actionIcon属性,简化组件接口
- 确保图标在模板中正确渲染
---
src/components/common/CoiEmpty.vue | 39 +++++++++---------------------
1 file changed, 11 insertions(+), 28 deletions(-)
diff --git a/src/components/common/CoiEmpty.vue b/src/components/common/CoiEmpty.vue
index 207be03..543b682 100644
--- a/src/components/common/CoiEmpty.vue
+++ b/src/components/common/CoiEmpty.vue
@@ -5,7 +5,12 @@
@@ -30,9 +35,10 @@
class="coi-empty__action-btn"
@click="handleAction"
>
-
+
-
+
+
{{ actionText }}
@@ -65,7 +71,6 @@ export interface CoiEmptyProps {
actionText?: string
actionType?: 'default' | 'primary' | 'info' | 'success' | 'warning' | 'error'
actionSize?: 'tiny' | 'small' | 'medium' | 'large'
- actionIcon?: any
size?: 'small' | 'medium' | 'large'
}
@@ -84,7 +89,6 @@ const props = withDefaults(defineProps(), {
actionText: '',
actionType: 'primary',
actionSize: 'medium',
- actionIcon: undefined,
size: 'medium',
})
@@ -95,37 +99,27 @@ const typeConfigs = {
default: {
title: '暂无数据',
description: '当前没有可显示的数据',
- icon: 'icon-park-outline:inbox',
},
search: {
title: '搜索无结果',
description: '未找到符合条件的数据,请尝试调整搜索条件',
- icon: 'icon-park-outline:search',
},
network: {
title: '网络异常',
description: '网络连接出现问题,请检查网络连接后重试',
- icon: 'icon-park-outline:wifi-error',
},
permission: {
title: '暂无权限',
description: '您没有访问此内容的权限,请联系管理员',
- icon: 'icon-park-outline:lock',
},
custom: {
title: '自定义状态',
description: '这是一个自定义的空状态',
- icon: 'icon-park-outline:folder-close',
},
}
-// 计算图标组件
-const iconComponent = computed(() => {
- if (props.icon) {
- return props.icon
- }
- return typeConfigs[props.type].icon
-})
+// 当前类型
+const currentType = computed(() => props.type)
// 计算标题
const title = computed(() => {
@@ -170,17 +164,6 @@ const actionButtonSize = computed(() => {
return sizeMap[props.size] as any
})
-const actionIconComponent = computed(() => {
- if (props.actionIcon) {
- return props.actionIcon
- }
- // 如果没有传入操作图标,根据类型返回默认图标
- if (props.type === 'search') {
- return 'icon-park-outline:refresh'
- }
- return 'icon-park-outline:plus'
-})
-
// 处理操作按钮点击
function handleAction() {
emit('action')