perf:优化infoCard组件样式

This commit is contained in:
Xwen
2023-12-25 23:06:19 +08:00
parent a3809b3fc7
commit f4eb31570e
3 changed files with 45 additions and 18 deletions

View File

@@ -1,7 +1,8 @@
<script setup> <script setup>
import { ref } from "vue"; import { ref } from "vue";
const props = defineProps(["items", "header", "text", "hideDivider"]); const props = defineProps(["items", "header", "text", "hideDivider", "height"]);
const height = ref(props.height + "px");
</script> </script>
<template> <template>
@@ -14,7 +15,7 @@ const props = defineProps(["items", "header", "text", "hideDivider"]);
</template> </template>
<slot name="content" /> <slot name="content" />
<el-scrollbar :height="height">
<div v-for="(item, i) in props.items"> <div v-for="(item, i) in props.items">
<div class="text item"> <div class="text item">
<slot name="item" v-bind="item" /> <slot name="item" v-bind="item" />
@@ -23,6 +24,7 @@ const props = defineProps(["items", "header", "text", "hideDivider"]);
v-if="i != props.items.length - 1 && hideDivider == undefined" v-if="i != props.items.length - 1 && hideDivider == undefined"
/> />
</div> </div>
</el-scrollbar>
</el-card> </el-card>
</template> </template>
@@ -47,5 +49,7 @@ const props = defineProps(["items", "header", "text", "hideDivider"]);
.box-card { .box-card {
width: 100%; width: 100%;
height: v-bind(height);
padding-bottom: 10px;
} }
</style> </style>

View File

@@ -73,7 +73,12 @@
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<InfoCard :items="pointList" header="本月排行" text="更多"> <InfoCard
:items="pointList"
header="本月排行"
text="更多"
height="400"
>
<template #item="temp"> <template #item="temp">
<PointsRanking :pointsData="temp" /> <PointsRanking :pointsData="temp" />
</template> </template>
@@ -81,7 +86,12 @@
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<InfoCard :items="friendList" header="推荐好友" text="更多"> <InfoCard
:items="friendList"
header="推荐好友"
text="更多"
height="400"
>
<template #item="temp"> <template #item="temp">
<RecommendFriend :friendData="temp" /> <RecommendFriend :friendData="temp" />
</template> </template>

View File

@@ -11,7 +11,16 @@
<el-tag effect="light" type="success">{{ pointsData.level }}</el-tag> <el-tag effect="light" type="success">{{ pointsData.level }}</el-tag>
</div> </div>
<div class="bottom"> <div class="bottom">
<div class="name">
<el-tooltip
class="box-item"
effect="dark"
:content="pointsData.userName"
placement="top"
>
{{ pointsData.userName }} {{ pointsData.userName }}
</el-tooltip>
</div>
</div> </div>
</div> </div>
<div class="right"> <div class="right">
@@ -95,7 +104,10 @@ const userImageSrc = computed(() => {
} }
} }
.bottom { .bottom {
width: 200px; width: 180px;
.name {
cursor: pointer;
width: 100%;
color: #252933; color: #252933;
margin-left: 5px; margin-left: 5px;
white-space: nowrap; white-space: nowrap;
@@ -103,6 +115,7 @@ const userImageSrc = computed(() => {
text-overflow: ellipsis; text-overflow: ellipsis;
} }
} }
}
.right { .right {
flex: 2; flex: 2;
display: flex; display: flex;