From 48cb33036a3f4d4c9c054ef9a8e6ffc8ec43c76f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B1=E7=9C=A0=E5=84=80=E5=BC=8F?= <854085467@qq.com> Date: Tue, 9 Aug 2022 20:59:04 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(component):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=20table=20=E5=9B=BA=E5=AE=9A=E5=88=97=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E5=88=97=E7=9A=84=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/src/component/switch/index.less | 5 ++--- .../component/src/component/table/TableRow.vue | 10 +++++----- package/component/src/component/table/index.vue | 16 +++++++++++----- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/package/component/src/component/switch/index.less b/package/component/src/component/switch/index.less index d871c191..2e3e6da3 100644 --- a/package/component/src/component/switch/index.less +++ b/package/component/src/component/switch/index.less @@ -85,13 +85,12 @@ .layui-form-switch em { position: relative; - top: 0; - width: 25px; - padding: 0 !important; text-align: center !important; color: #999 !important; font-style: normal !important; font-size: 12px; + width: 25px; + top: 0; } .layui-form-onswitch { diff --git a/package/component/src/component/table/TableRow.vue b/package/component/src/component/table/TableRow.vue index 0c57e91f..f70da8db 100644 --- a/package/component/src/component/table/TableRow.vue +++ b/package/component/src/component/table/TableRow.vue @@ -176,7 +176,7 @@ const renderFixedStyle = (column: any, columnIndex: number) => { if (column.fixed == "left") { var left = 0; for (var i = 0; i < columnIndex; i++) { - if (props.columns[i].fixed && props.columns[i].fixed == "left") { + if (props.columns[i].fixed && props.columns[i].fixed == "left" && props.tableColumnKeys.includes(props.columns[i].key)) { left = left + props.columns[i]?.width.replace("px", ""); } } @@ -184,7 +184,7 @@ const renderFixedStyle = (column: any, columnIndex: number) => { } else { var right = 0; for (var i = columnIndex + 1; i < props.columns.length; i++) { - if (props.columns[i].fixed && props.columns[i].fixed == "right") { + if (props.columns[i].fixed && props.columns[i].fixed == "right" && props.tableColumnKeys.includes(props.columns[i].key)) { right = right + props.columns[i]?.width.replace("px", ""); } } @@ -193,7 +193,7 @@ const renderFixedStyle = (column: any, columnIndex: number) => { } else { var isLast = true; for (var i = columnIndex + 1; i < props.columns.length; i++) { - if (props.columns[i].fixed == undefined) { + if (props.columns[i].fixed == undefined && props.tableColumnKeys.includes(props.columns[i].key)) { isLast = false; } } @@ -207,7 +207,7 @@ const renderFixedClassName = (column: any, columnIndex: number) => { if (column.fixed == "left") { var left = true; for (var i = columnIndex + 1; i < props.columns.length; i++) { - if (props.columns[i].fixed && props.columns[i].fixed == "left") { + if (props.columns[i].fixed && props.columns[i].fixed == "left" && props.tableColumnKeys.includes(props.columns[i].key)) { left = false; } } @@ -215,7 +215,7 @@ const renderFixedClassName = (column: any, columnIndex: number) => { } else { var right = true; for (var i = 0; i < columnIndex; i++) { - if (props.columns[i].fixed && props.columns[i].fixed == "right") { + if (props.columns[i].fixed && props.columns[i].fixed == "right" && props.tableColumnKeys.includes(props.columns[i].key)) { right = false; } } diff --git a/package/component/src/component/table/index.vue b/package/component/src/component/table/index.vue index fde78057..bb8a94cb 100644 --- a/package/component/src/component/table/index.vue +++ b/package/component/src/component/table/index.vue @@ -473,12 +473,15 @@ props.dataSource.map((value: any) => { } }); +/** + * @remark 排除 hide 列 + */ const renderFixedStyle = (column: any, columnIndex: number) => { if (column.fixed) { if (column.fixed == "left") { var left = 0; for (var i = 0; i < columnIndex; i++) { - if (props.columns[i].fixed && props.columns[i].fixed == "left") { + if (props.columns[i].fixed && props.columns[i].fixed == "left" && tableColumnKeys.value.includes(props.columns[i].key)) { left = left + props.columns[i]?.width.replace("px", ""); } } @@ -486,7 +489,7 @@ const renderFixedStyle = (column: any, columnIndex: number) => { } else { var right = 0; for (var i = columnIndex + 1; i < props.columns.length; i++) { - if (props.columns[i].fixed && props.columns[i].fixed == "right") { + if (props.columns[i].fixed && props.columns[i].fixed == "right" && tableColumnKeys.value.includes(props.columns[i].key)) { right = right + props.columns[i]?.width.replace("px", ""); } } @@ -495,7 +498,7 @@ const renderFixedStyle = (column: any, columnIndex: number) => { } else { var isLast = true; for (var i = columnIndex + 1; i < props.columns.length; i++) { - if (props.columns[i].fixed == undefined) { + if (props.columns[i].fixed == undefined && tableColumnKeys.value.includes(props.columns[i].key)) { isLast = false; } } @@ -504,12 +507,15 @@ const renderFixedStyle = (column: any, columnIndex: number) => { return {} as StyleValue; }; +/** + * @remark 排除 hide 列 + */ const renderFixedClassName = (column: any, columnIndex: number) => { if (column.fixed) { if (column.fixed == "left") { var left = true; for (var i = columnIndex + 1; i < props.columns.length; i++) { - if (props.columns[i].fixed && props.columns[i].fixed == "left") { + if (props.columns[i].fixed && props.columns[i].fixed == "left" && tableColumnKeys.value.includes(props.columns[i].key)) { left = false; } } @@ -517,7 +523,7 @@ const renderFixedClassName = (column: any, columnIndex: number) => { } else { var right = true; for (var i = 0; i < columnIndex; i++) { - if (props.columns[i].fixed && props.columns[i].fixed == "right") { + if (props.columns[i].fixed && props.columns[i].fixed == "right" && tableColumnKeys.value.includes(props.columns[i].key)) { right = false; } }