You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
156 lines
2.5 KiB
Vue
156 lines
2.5 KiB
Vue
<template>
|
|
<div class="card">
|
|
<div class="head">{{title}}</div>
|
|
<div class="content">
|
|
<div class="left">
|
|
<div class="inner">
|
|
<div>
|
|
<div class="value" :class="items.color">{{ items[0].value }}</div>
|
|
<div class="label">{{ items[0].label }}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="right">
|
|
<div class="inner">
|
|
<div class="item"></div>
|
|
<div
|
|
v-for="(item, index) in items.slice(1)"
|
|
:key="index"
|
|
class="item"
|
|
>
|
|
<div class="value" :class="item.color">
|
|
<span>
|
|
{{ item.label }}
|
|
</span>
|
|
<span style="font-weight: bold;font-size: 22px;margin-left: 12px;">
|
|
{{ item.value }}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<div class="item"></div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { computed } from 'vue';
|
|
|
|
const props = defineProps({
|
|
title: {
|
|
type: String,
|
|
required: true
|
|
},
|
|
items: {
|
|
type: Array,
|
|
default: () => []
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
.red {
|
|
color: #f56c6c;
|
|
}
|
|
|
|
|
|
.green {
|
|
color: #67c23a;
|
|
}
|
|
|
|
|
|
.blue {
|
|
color: #409eff;
|
|
}
|
|
|
|
.card {
|
|
height: 100%;
|
|
background-color: #fff;
|
|
border: 1px solid #ddd;
|
|
border-radius: 8px;
|
|
position: relative;
|
|
margin-right: 16px;
|
|
&:last-child{
|
|
margin-right: 0;
|
|
}
|
|
}
|
|
.head{
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
background-color: #5085FD;
|
|
color: #fff;
|
|
font-size: 0.8vw;
|
|
width: 4vw;
|
|
height: 1.5vw;
|
|
text-align: center;
|
|
line-height: 1.5vw;
|
|
border-bottom-right-radius: 1.5vw;
|
|
}
|
|
|
|
.content {
|
|
height: 100%;
|
|
}
|
|
|
|
.item {
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
.left {
|
|
height: calc(100% - 2vw);
|
|
margin: 1vw 0;
|
|
width: 50%;
|
|
display: inline-block;
|
|
text-align: center;
|
|
border-right: 1px solid #ddd;
|
|
|
|
.inner {
|
|
height: 100%;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
|
|
.value {
|
|
font-size: 22px;
|
|
font-weight: 600;
|
|
line-height: 1.2;
|
|
}
|
|
|
|
.label {
|
|
font-size: 13px;
|
|
color: #909399;
|
|
margin-top: 4px;
|
|
}
|
|
}
|
|
|
|
|
|
.right {
|
|
height: calc(100% - 2vw);
|
|
margin: 1vw 0;
|
|
width: 50%;
|
|
display: inline-block;
|
|
vertical-align: top;
|
|
|
|
.inner {
|
|
height: 100%;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.value {
|
|
font-size: 14px;
|
|
line-height: 1.2;
|
|
padding: 0.2vw 0;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
</style>
|