湖里大屏(数字工地):封装 DeviceCard 组件

This commit is contained in:
Jack 2022-08-04 16:46:41 +08:00
parent d950a89b2f
commit b422afc48e
2 changed files with 91 additions and 28 deletions

View File

@ -0,0 +1,79 @@
<template>
<div class="h-device-card">
<div class="counts">
<div class="count">
<div class="icon"></div>
<div class="info">
<div class="num blue">{{ leftCount.value }}</div>
<div class="label">{{ leftCount.label }}</div>
</div>
</div>
<div class="count">
<div class="icon"></div>
<div class="info">
<div class="num red">{{ rightCount.value }}</div>
<div class="label">{{ rightCount.label }}</div>
</div>
</div>
</div>
<slot></slot>
</div>
</template>
<script>
export default {
props: {
leftCount: {
type: Object,
required: true,
default: () => ({
img: '',
value: '',
label: ''
})
},
rightCount: {
type: Object,
required: true,
default: () => ({
img: '',
value: '',
label: '',
color: ''
})
}
}
}
</script>
<style lang="less" scoped>
.h-device-card {
width: 100%;
height: 100%;
.counts {
padding: 10px 26px 20px;
display: flex;
.count {
flex: 1;
display: flex;
align-items: center;
.icon {
margin-right: 10px;
width: 52px;
height: 52px;
border: 1px solid red;
}
.info {
color: #fff;
.num {
margin-bottom: 6px;
font-size: 18px;
}
.label {
font-size: 14px;
}
}
}
}
}
</style>

View File

@ -1,42 +1,26 @@
<template>
<!-- 人员类别 -->
<div class="container">
<div class="titleTxt">{{ title }}</div>
</div>
<Card :title="title">
<DeviceCard :leftCount="{ value: 22, label: '塔吊设备数' }" :rightCount="{ value: 65, label: '今日报警数' }">
hello
</DeviceCard>
</Card>
</template>
<script>
import Card from '../components/Card.vue'
import DeviceCard from './components/DeviceCard.vue'
export default {
components: { Card, DeviceCard },
props: {
title: {
type: String,
default: "default title"
default: ''
}
},
data() {
return {
};
},
return {}
}
}
</script>
<style lang="less" scoped>
.container {
width: 100%;
height: 100%;
border: 1px solid #0081c3;
.titleTxt {
font-size: 18px;
color: #6ee4f0;
margin-top: 5px;
margin-left: 5px;
}
}
</style>
<style lang="less" scoped></style>