feat: 响应式网格系统
This commit is contained in:
parent
5dfe39be85
commit
5e69360b74
133
src/views/home/components/finance copy.vue
Normal file
133
src/views/home/components/finance copy.vue
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
<template>
|
||||||
|
<div class="finance-box">
|
||||||
|
<div class="box-title">
|
||||||
|
<div>财务指标</div>
|
||||||
|
<div>
|
||||||
|
<span><icon-edit /></span>
|
||||||
|
<span class="margin-left-text">自定义</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<a-divider :margin="16" />
|
||||||
|
<!-- <div class="finance-card"> -->
|
||||||
|
<a-grid class="finance-card" :cols="{ xs: 1, sm: 2, md: 3, lg: 4, xl: 5, xxl: 6 }" :col-gap="12" :row-gap="16">
|
||||||
|
<a-grid-item v-for="(item, index) in financeData" :key="index">
|
||||||
|
<a-card hoverable class="finance-a-card" :class="'animated-fade-up-' + index">
|
||||||
|
<div class="finance-nav">
|
||||||
|
<div class="tag-dot" :style="{ border: `3px solid ${item.color}` }"></div>
|
||||||
|
<span class="finance-nav-title">{{ item.title }}</span>
|
||||||
|
</div>
|
||||||
|
<a-statistic
|
||||||
|
:value-style="{
|
||||||
|
fontSize: '13px',
|
||||||
|
marginLeft: '16px',
|
||||||
|
marginTop: '12px'
|
||||||
|
}"
|
||||||
|
:value="item.value"
|
||||||
|
:value-from="0"
|
||||||
|
:start="true"
|
||||||
|
animation
|
||||||
|
show-group-separator
|
||||||
|
/>
|
||||||
|
</a-card>
|
||||||
|
</a-grid-item>
|
||||||
|
</a-grid>
|
||||||
|
<!-- <a-card
|
||||||
|
hoverable
|
||||||
|
v-for="(item, index) in financeData"
|
||||||
|
:key="index"
|
||||||
|
class="finance-a-card"
|
||||||
|
:class="'animated-fade-up-' + index"
|
||||||
|
>
|
||||||
|
<div class="finance-nav">
|
||||||
|
<div class="tag-dot" :style="{ border: `3px solid ${item.color}` }"></div>
|
||||||
|
<span class="finance-nav-title">{{ item.title }}</span>
|
||||||
|
</div>
|
||||||
|
<a-statistic
|
||||||
|
:value-style="{
|
||||||
|
fontSize: '13px',
|
||||||
|
marginLeft: '16px',
|
||||||
|
marginTop: '12px'
|
||||||
|
}"
|
||||||
|
:value="item.value"
|
||||||
|
:value-from="0"
|
||||||
|
:start="true"
|
||||||
|
animation
|
||||||
|
show-group-separator
|
||||||
|
/>
|
||||||
|
</a-card> -->
|
||||||
|
<!-- </div> -->
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
const financeData = ref([
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
title: "利润总额",
|
||||||
|
value: 100000,
|
||||||
|
color: "#ff8625"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
title: "现金",
|
||||||
|
value: 750420,
|
||||||
|
color: "#165DFF"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
title: "银行存款",
|
||||||
|
value: 100000,
|
||||||
|
color: "#39cbab"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
title: "存贷",
|
||||||
|
value: 100000,
|
||||||
|
color: "#6c73ff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 5,
|
||||||
|
title: "应收账款",
|
||||||
|
value: 100000,
|
||||||
|
color: "#2fd0ff"
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.finance-box {
|
||||||
|
margin-top: calc($padding * 2);
|
||||||
|
.finance-card {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(5, 1fr);
|
||||||
|
grid-template-rows: 1fr;
|
||||||
|
grid-column-gap: $padding;
|
||||||
|
grid-row-gap: 0px;
|
||||||
|
border: 1px solid cyan;
|
||||||
|
.finance-a-card {
|
||||||
|
.finance-nav {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
border: 1px solid red;
|
||||||
|
.tag-dot {
|
||||||
|
width: 8px;
|
||||||
|
height: 8px;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-right: $margin-text;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.finance-nav-title {
|
||||||
|
font-size: $font-size-body-1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.box-title {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
font-size: $font-size-body-3;
|
||||||
|
color: $color-text-1;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -8,35 +8,32 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a-divider :margin="16" />
|
<a-divider :margin="16" />
|
||||||
<div class="finance-card">
|
<!-- 对于奇数的响应式系统来说,普通横向栅格或许满足不了
|
||||||
<!-- <a-row>
|
这里使用响应式网格系统,根据网格系统来分配每行的空间占比
|
||||||
<a-col :xs="24" :sm="12" :lg="8" :xl="4"></a-col>
|
这里xl大小每行5个、lg大小每行3个,依此类推,这样可以完美解决奇数的响应式布局
|
||||||
</a-row> -->
|
另外也可以设置横、纵向的网格间距(默认单位px) -->
|
||||||
<a-card
|
<a-grid class="finance-card" :cols="{ xs: 1, sm: 2, lg: 3, xl: 5 }" :col-gap="16" :row-gap="16">
|
||||||
hoverable
|
<a-grid-item v-for="(item, index) in financeData" :key="index">
|
||||||
v-for="(item, index) in financeData"
|
<a-card hoverable class="finance-a-card" :class="'animated-fade-up-' + index">
|
||||||
:key="index"
|
<div class="finance-nav">
|
||||||
class="finance-a-card"
|
<div class="tag-dot" :style="{ border: `3px solid ${item.color}` }"></div>
|
||||||
:class="'animated-fade-up-' + index"
|
<span class="finance-nav-title">{{ item.title }}</span>
|
||||||
>
|
</div>
|
||||||
<div class="finance-nav">
|
<a-statistic
|
||||||
<div class="tag-dot" :style="{ border: `3px solid ${item.color}` }"></div>
|
:value-style="{
|
||||||
<span class="finance-nav-title">{{ item.title }}</span>
|
fontSize: '13px',
|
||||||
</div>
|
marginLeft: '16px',
|
||||||
<a-statistic
|
marginTop: '12px'
|
||||||
:value-style="{
|
}"
|
||||||
fontSize: '13px',
|
:value="item.value"
|
||||||
marginLeft: '16px',
|
:value-from="0"
|
||||||
marginTop: '12px'
|
:start="true"
|
||||||
}"
|
animation
|
||||||
:value="item.value"
|
show-group-separator
|
||||||
:value-from="0"
|
/>
|
||||||
:start="true"
|
</a-card>
|
||||||
animation
|
</a-grid-item>
|
||||||
show-group-separator
|
</a-grid>
|
||||||
/>
|
|
||||||
</a-card>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -78,26 +75,19 @@ const financeData = ref([
|
|||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.finance-box {
|
.finance-box {
|
||||||
margin-top: calc($padding * 2);
|
margin-top: calc($padding * 2);
|
||||||
.finance-card {
|
.finance-a-card {
|
||||||
display: grid;
|
.finance-nav {
|
||||||
grid-template-columns: repeat(5, 1fr);
|
display: flex;
|
||||||
grid-template-rows: 1fr;
|
align-items: center;
|
||||||
grid-column-gap: $padding;
|
.tag-dot {
|
||||||
grid-row-gap: 0px;
|
width: 8px;
|
||||||
.finance-a-card {
|
height: 8px;
|
||||||
.finance-nav {
|
border-radius: 50%;
|
||||||
display: flex;
|
margin-right: $margin-text;
|
||||||
align-items: center;
|
box-sizing: border-box;
|
||||||
.tag-dot {
|
}
|
||||||
width: 8px;
|
.finance-nav-title {
|
||||||
height: 8px;
|
font-size: $font-size-body-1;
|
||||||
border-radius: 50%;
|
|
||||||
margin-right: $margin-text;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
.finance-nav-title {
|
|
||||||
font-size: $font-size-body-1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user