🐛(component): table 边框不对其的问题

This commit is contained in:
就眠儀式 2022-07-11 09:26:44 +08:00
parent dec00677f4
commit 6a7a429c13
2 changed files with 26 additions and 20 deletions

View File

@ -125,7 +125,7 @@ const childrenIndentSize = props.currentIndentSize + props.indentSize;
const renderFixedStyle = (column: any, columnIndex: number) => { const renderFixedStyle = (column: any, columnIndex: number) => {
if (column.fixed) { if (column.fixed) {
if(column.fixed == 'left') { if (column.fixed == "left") {
var left = 0; var left = 0;
for (var i = 0; i < columnIndex; i++) { for (var i = 0; i < columnIndex; i++) {
left = left + props.columns[i]?.width.replace("px", ""); left = left + props.columns[i]?.width.replace("px", "");
@ -139,7 +139,7 @@ const renderFixedStyle = (column: any, columnIndex: number) => {
return `right:${right}px`; return `right:${right}px`;
} }
} }
} };
</script> </script>
<template> <template>

View File

@ -252,7 +252,7 @@ props.dataSource.map((value: any) => {
const renderFixedStyle = (column: any, columnIndex: number) => { const renderFixedStyle = (column: any, columnIndex: number) => {
if (column.fixed) { if (column.fixed) {
if(column.fixed == 'left') { if (column.fixed == "left") {
var left = 0; var left = 0;
for (var i = 0; i < columnIndex; i++) { for (var i = 0; i < columnIndex; i++) {
left = left + props.columns[i]?.width.replace("px", ""); left = left + props.columns[i]?.width.replace("px", "");
@ -266,7 +266,7 @@ const renderFixedStyle = (column: any, columnIndex: number) => {
return `right:${right}px`; return `right:${right}px`;
} }
} }
} };
</script> </script>
<template> <template>
@ -344,16 +344,22 @@ const renderFixedStyle = (column: any, columnIndex: number) => {
/> />
</div> </div>
</th> </th>
<template v-for="(column, columnIndex) in columns" :key="column"> <template
v-for="(column, columnIndex) in columns"
:key="column"
>
<th <th
v-if="tableColumnKeys.includes(column.key)" v-if="tableColumnKeys.includes(column.key)"
class="layui-table-cell" class="layui-table-cell"
:class="[ :class="[
column.fixed ? `layui-table-fixed-${column.fixed}` : '', column.fixed ? `layui-table-fixed-${column.fixed}` : '',
]" ]"
:style="[{ :style="[
{
textAlign: column.align, textAlign: column.align,
},renderFixedStyle(column,columnIndex)]" },
renderFixedStyle(column, columnIndex),
]"
> >
<span> <span>
<template v-if="column.titleSlot"> <template v-if="column.titleSlot">