2025-06-05 18:01:31 +08:00
|
|
|
<!-- components/empty/empty.vue -->
|
|
|
|
|
<template>
|
2025-07-11 11:03:39 +08:00
|
|
|
<view
|
|
|
|
|
class="empty-container"
|
|
|
|
|
:style="{
|
|
|
|
|
height: props.height,
|
|
|
|
|
}"
|
|
|
|
|
>
|
|
|
|
|
<view class="empty-content">
|
|
|
|
|
<!-- 图标 -->
|
|
|
|
|
<view class="empty-icon" v-if="showIcon">
|
|
|
|
|
<image :src="icon" mode="aspectFit" class="empty-image" />
|
2025-06-05 18:01:31 +08:00
|
|
|
</view>
|
2025-07-11 11:03:39 +08:00
|
|
|
|
|
|
|
|
<!-- 描述 -->
|
|
|
|
|
<text class="empty-description">{{ description }}</text>
|
2025-06-05 18:01:31 +08:00
|
|
|
</view>
|
2025-07-11 11:03:39 +08:00
|
|
|
</view>
|
|
|
|
|
</template>
|
2025-06-05 18:01:31 +08:00
|
|
|
|
2025-07-11 11:03:39 +08:00
|
|
|
<script setup>
|
|
|
|
|
import { computed } from "vue";
|
|
|
|
|
import staticIcon from "./static_icon.js";
|
|
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
// 空状态类型:'default' | 'error'
|
|
|
|
|
type: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: "default",
|
|
|
|
|
},
|
|
|
|
|
// 自定义图标地址
|
|
|
|
|
icon: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: staticIcon.base64Empty,
|
|
|
|
|
},
|
|
|
|
|
// 描述文案
|
|
|
|
|
description: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: "这里还没有任何内容",
|
|
|
|
|
},
|
|
|
|
|
// 是否显示图标
|
|
|
|
|
showIcon: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: true,
|
|
|
|
|
},
|
|
|
|
|
// 高度
|
|
|
|
|
height: {
|
|
|
|
|
type: [String, Number],
|
|
|
|
|
default: "100vh",
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
</script>
|
2025-06-05 18:01:31 +08:00
|
|
|
|
2025-07-11 11:03:39 +08:00
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.empty-container {
|
|
|
|
|
width: 100%;
|
|
|
|
|
padding: 60rpx 0;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
|
|
.empty-content {
|
2025-06-05 18:01:31 +08:00
|
|
|
display: flex;
|
2025-07-11 11:03:39 +08:00
|
|
|
flex-direction: column;
|
2025-06-05 18:01:31 +08:00
|
|
|
align-items: center;
|
2025-07-11 11:03:39 +08:00
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
|
|
.empty-icon {
|
|
|
|
|
width: 240rpx;
|
|
|
|
|
height: 240rpx;
|
|
|
|
|
margin-bottom: 30rpx;
|
|
|
|
|
|
|
|
|
|
.empty-image {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
2025-06-05 18:01:31 +08:00
|
|
|
}
|
|
|
|
|
}
|
2025-07-11 11:03:39 +08:00
|
|
|
|
|
|
|
|
.empty-description {
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
color: #999;
|
|
|
|
|
}
|
2025-06-05 18:01:31 +08:00
|
|
|
}
|
2025-07-11 11:03:39 +08:00
|
|
|
}
|
|
|
|
|
</style>
|