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
68
| <template>
| <view
| class="cl-empty"
| :class="{
| 'is-fixed': fixed,
| }"
| :style="[baseStyle]"
| >
| <image
| class="cl-empty__icon"
| :src="`/static/empty/${icon}.png`"
| :style="{
| height: parseRpx(iconSize),
| }"
| mode="aspectFit"
| v-if="showIcon"
| />
|
| <text class="cl-empty__text" v-if="text">{{ text }}</text>
|
| <view class="cl-empty__container" v-if="$slots.default">
| <slot></slot>
| </view>
| </view>
| </template>
|
| <script lang="ts">
| import { type PropType, defineComponent } from "vue";
| import { useStyle } from "../../hooks";
| import { t } from "/@/locale";
|
| export default defineComponent({
| name: "cl-empty",
|
| props: {
| // 图标
| icon: {
| type: String as PropType<"comm">,
| default: "comm",
| },
| // 图标大小
| iconSize: [String, Number],
| // 暂无数据文案
| text: {
| type: String,
| default: t("暂无数据"),
| },
| // 是否固定
| fixed: {
| type: Boolean,
| default: true,
| },
| // 是否显示图标
| showIcon: {
| type: Boolean,
| default: true,
| },
| },
|
| setup() {
| return {
| ...useStyle({
| height: "100%",
| }),
| };
| },
| });
| </script>
|
|