feat: 添加空状态组件,优化数据为空时的展示效果

This commit is contained in:
2026-01-09 01:15:42 +07:00
parent 83385b9d88
commit 08186fa752
4 changed files with 53 additions and 22 deletions

25
src/ui/empty/index.vue Normal file
View File

@@ -0,0 +1,25 @@
<script lang='ts' setup>
import empty from "@/assets/images/empty.png?url";
withDefaults(defineProps<{
image?: string;
title?: string;
}>(), {
image: empty,
title: "暂无数据",
});
</script>
<template>
<div class="flex flex-col-center space-y-2 my-4">
<slot name="icon">
<img :src="empty" class="w-22 h-22 object-contain">
</slot>
<div class="text-sm text-text-400">
{{ title }}
</div>
<slot name="extra" />
</div>
</template>
<style lang='css' scoped></style>

View File

@@ -36,5 +36,6 @@ declare module "vue" {
UiTag: typeof import("./tag/index.vue")["default"];
UiTextareaLabel: typeof import("./textarea-label/index.vue")["default"];
UiBackButton: typeof import("./back-button/index.vue")["default"];
UiEmpty: typeof import("./empty/index.vue")["default"];
}
}