2023-10-25 10:35:28 +00:00
|
|
|
<template>
|
2023-11-02 01:56:14 +00:00
|
|
|
<el-card shadow="always" class="card-box" @mouseenter="cardEnter()" @mouseleave="cardLeave()">
|
2023-10-25 10:35:28 +00:00
|
|
|
<div class="card-header">
|
|
|
|
|
<slot name="header">
|
2023-10-26 10:37:13 +00:00
|
|
|
<div class="title flex align-center">
|
2023-11-02 10:25:09 +00:00
|
|
|
<AppAvatar class="mr-8">
|
2023-10-25 10:35:28 +00:00
|
|
|
<el-icon><Document /></el-icon>
|
|
|
|
|
</AppAvatar>
|
2023-10-26 10:37:13 +00:00
|
|
|
<h4>{{ title }}</h4>
|
2023-10-25 10:35:28 +00:00
|
|
|
</div>
|
|
|
|
|
</slot>
|
|
|
|
|
</div>
|
2023-11-02 10:25:09 +00:00
|
|
|
<div class="description mt-8">
|
2023-10-25 10:35:28 +00:00
|
|
|
<slot name="description">
|
|
|
|
|
{{ description }}
|
|
|
|
|
</slot>
|
|
|
|
|
</div>
|
|
|
|
|
<slot />
|
|
|
|
|
<slot name="mouseEnter" v-if="$slots.mouseEnter && show" />
|
|
|
|
|
<div class="card-footer" v-if="$slots.footer">
|
|
|
|
|
<slot name="footer" />
|
|
|
|
|
</div>
|
|
|
|
|
</el-card>
|
|
|
|
|
</template>
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { ref, watch } from 'vue'
|
|
|
|
|
defineOptions({ name: 'CardBox' })
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
title: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: '标题'
|
|
|
|
|
},
|
|
|
|
|
description: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: ''
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const show = ref(false)
|
|
|
|
|
function cardEnter() {
|
|
|
|
|
show.value = true
|
|
|
|
|
}
|
|
|
|
|
function cardLeave() {
|
|
|
|
|
show.value = false
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.card-box {
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
position: relative;
|
|
|
|
|
min-height: 150px;
|
|
|
|
|
|
|
|
|
|
.description {
|
|
|
|
|
display: -webkit-box;
|
|
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
|
-webkit-line-clamp: 2;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
height: 40px;
|
|
|
|
|
}
|
|
|
|
|
.card-footer {
|
|
|
|
|
position: absolute;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
min-height: 30px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|