EmptyState.vue
1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<script setup>
/**
* EmptyState —— 列表空态。标题 + 说明经 props,行动按钮经 `action` 插槽。
*/
defineProps({
/** 一句话说清「这里什么都没有」。 */
title: { type: String, required: true },
/** 补一句为什么空 / 下一步做什么。 */
description: { type: String, default: '' },
})
</script>
<template>
<div class="drama-empty">
<p class="drama-empty__title">
{{ title }}
</p>
<p
v-if="description"
class="drama-empty__desc"
>
{{ description }}
</p>
<div
v-if="$slots.action"
class="drama-empty__action"
>
<slot name="action" />
</div>
</div>
</template>
<style scoped>
.drama-empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: var(--drama-space-sm);
padding: var(--drama-space-2xl) var(--drama-space-xl);
border: 1px dashed var(--drama-color-border);
border-radius: var(--drama-radius-lg);
background-color: var(--drama-color-surface);
text-align: center;
font-family: var(--drama-font-family-body);
}
.drama-empty__title {
margin: 0;
color: var(--drama-color-text);
font-family: var(--drama-font-family-heading);
font-size: var(--drama-font-size-md);
font-weight: var(--drama-font-weight-bold);
}
.drama-empty__desc {
margin: 0;
max-width: 420px;
color: var(--drama-color-text-muted);
font-size: var(--drama-font-size-sm);
}
.drama-empty__action {
margin-top: var(--drama-space-sm);
}
</style>