Commit 379356de by chenwq

fix(表格): 修复表格高度和样式问题

调整StickyTable组件高度逻辑,当数据少于5条时自动适应高度
修复表头和单元格的padding样式问题
为空数据项显示默认'-'字符
1 parent 6617e135
<template>
<div class="sticky-table-container" :style="{ height: height }">
<div class="sticky-table-wrapper">
<div class="sticky-table-wrapper" :style="{ height: data.length > 5 ? '100%' : '' }">
<table class="sticky-table">
<thead>
<tr>
......@@ -78,7 +78,7 @@ export default {
.sticky-table-wrapper {
overflow: auto;
height: 100%;
// height: 100%;
.sticky-table {
border-collapse: separate; // sticky需要separate或collapse配合特定处理,separate较安全
......@@ -125,7 +125,7 @@ export default {
// }
th:first-child,
td:first-child {
padding: 2px 8px 14px 0;
padding: 4px 8px 4px 0;
}
th {
......@@ -134,6 +134,7 @@ export default {
z-index: 10;
color: #999999;
font-size: 12px;
padding-top: 0;
}
// 固定第一列样式
......@@ -160,7 +161,7 @@ export default {
// 表头和第一列交叉的单元格
th.fixed-col {
padding: 2px 8px 14px 0;
padding: 4px 8px 4px 0;
z-index: 15; // 最高层级
background: #fff;
}
......
......@@ -5,7 +5,7 @@
<div class="label">
{{ item.label }}
</div>
<div>{{ item.formatter ? item.formatter(infoData) : infoData[item.prop] }}</div>
<div>{{ item.formatter ? item.formatter(infoData) : (infoData[item.prop] || '-') }}</div>
</div>
</div>
</h-dialog>
......
......@@ -25,7 +25,7 @@
<div class="title">
商品信息<span class="title-tip">点击商品名称可查看商品全部信息</span>
</div>
<StickyTable :columns="tableColumns" :data="purchaseOrderInfo.goodsList" height="216px">
<StickyTable :columns="tableColumns" :data="purchaseOrderInfo.goodsList" :height="purchaseOrderInfo?.goodsList?.length > 5 ? '216px' : 'auto'">
<template #upgradeGoodsName="{ row }">
<span style="color: #347bff; cursor: pointer;" @click="handleProductClick(row)">{{ row.upgradeGoodsName }}</span>
</template>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!