(component): 实现 table 行列固定, 待完善

This commit is contained in:
就眠儀式
2022-07-04 00:01:54 +08:00
parent fd3ca29bd0
commit 7dcb7c507c
4 changed files with 80 additions and 12 deletions

View File

@@ -158,7 +158,7 @@ const childrenIndentSize = props.currentIndentSize + props.indentSize;
},
renderCellStyle(data, column, index, columnIndex),
]"
:class="[renderCellClassName(data, column, index, columnIndex)]"
:class="[renderCellClassName(data, column, index, columnIndex),column.fixed ? `layui-table-fixed-${column.fixed}` : '']"
>
<!-- 树表占位与缩进 -->
<span
@@ -208,7 +208,7 @@ const childrenIndentSize = props.currentIndentSize + props.indentSize;
},
renderCellStyle(data, column, index, columnIndex),
]"
:class="[renderCellClassName(data, column, index, columnIndex)]"
:class="[renderCellClassName(data, column, index, columnIndex),column.fixed ? `layui-table-fixed-${column.fixed}` : '']"
>
<!-- 树表占位与缩进 -->
<span

View File

@@ -419,20 +419,28 @@
overflow: hidden;
}
.layui-table-fixed-l {
.layui-table-fixed-left {
left: 0;
z-index: 2;
display: block;
position: sticky!important;
box-shadow: 1px 0 8px rgba(0, 0, 0, 0.08);
}
.layui-table-fixed-r {
left: auto;
right: -1px;
border-width: 0 0 0 1px;
.layui-table-fixed-right {
right: 0;
z-index: 2;
display: block;
position: sticky!important;
box-shadow: -1px 0 8px rgba(0, 0, 0, 0.08);
}
.layui-table-fixed-r .layui-table-header {
position: relative;
overflow: visible;
.layui-table-header .layui-table-cell {
background: #FAFAFA;
}
.layui-table-body .layui-table-cell {
background: white;
}
.layui-table-mend {

View File

@@ -327,6 +327,7 @@ props.dataSource.map((value: any) => {
<th
v-if="tableColumnKeys.includes(column.key)"
class="layui-table-cell"
:class="[column.fixed ? `layui-table-fixed-${column.fixed}` : '']"
:style="{
textAlign: column.align,
}"