<template>
|
<!-- 带icon首页 -->
|
<div class="icon-card" :class="currentThemeMode === 'dark' ? 'card-dark' : ''">
|
<a-card class="card-box">
|
<div class="card-icon" :style="dynamicStyle">
|
<Svg :name="icon" :width="26" :height="26"></Svg>
|
<!-- <img src="../../../assets/images/icon-house.png" alt="" /> -->
|
</div>
|
<div class="card-content">
|
<p>{{ title }}</p>
|
<p>
|
<span class="metering" :style="{ color: colorBg }">{{ metering }}</span>
|
<span>{{ unit }}</span>
|
</p>
|
</div>
|
</a-card>
|
</div>
|
</template>
|
<script lang="ts" setup name="TheIconCard">
|
import { useTheme } from "@/hooks/useTheme";
|
import { Svg } from "@easyfe/admin-component";
|
|
const { themeModeOptions, currentThemeMode, handleThemeChange } = useTheme();
|
const props = withDefaults(
|
defineProps<{
|
icon?: string;
|
title?: string;
|
unit?: string;
|
metering?: number;
|
colorBg?: string;
|
}>(),
|
{
|
icon: "",
|
title: "",
|
unit: "",
|
metering: 0,
|
colorBg: "#fff"
|
}
|
);
|
|
const colorBg = computed(() => {
|
return props.colorBg;
|
});
|
const dynamicStyle = {
|
backgroundColor: colorBg.value // 动态背景色
|
};
|
</script>
|
<style lang="scss" scoped>
|
.card-dark {
|
.card-box {
|
border: 1px solid #0e9cff;
|
display: flex;
|
align-items: center;
|
// justify-content: center;
|
}
|
}
|
.icon-card {
|
// min-width: 88px;
|
// max-width: 208px;
|
width: 100%;
|
min-height: 77px;
|
border-radius: 4px;
|
box-sizing: border-box;
|
margin-right: 10px;
|
flex: 1;
|
&:last-child {
|
margin-right: 0;
|
}
|
.card-box {
|
width: 100%;
|
height: 100%;
|
}
|
.card-icon {
|
width: 50px;
|
height: 50px;
|
|
border-radius: 10px;
|
opacity: 1;
|
// background: #2e85ff;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
:deep(.arco-card-body) {
|
display: flex;
|
align-items: center;
|
// justify-content: center;
|
}
|
.card-content {
|
margin-left: 20px;
|
line-height: 22px;
|
color: var(--color-text-1);
|
font-size: 12px;
|
.metering {
|
font-size: 14px;
|
margin-right: 4px;
|
}
|
}
|
}
|
</style>
|