✨(component): 实现 table 行列固定, 待完善
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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,
|
||||
}"
|
||||
|
||||
Reference in New Issue
Block a user