From 5d012662a3902adf4eb4980f10d40de874eacf7d Mon Sep 17 00:00:00 2001 From: zq <136432190602163.com> Date: Thu, 29 May 2025 14:41:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mixins/tableResizeMixin.js | 79 ------------------------------------------ 1 file changed, 79 deletions(-) diff --git a/src/mixins/tableResizeMixin.js b/src/mixins/tableResizeMixin.js index 5634b3b..6bb9027 100644 --- a/src/mixins/tableResizeMixin.js +++ b/src/mixins/tableResizeMixin.js @@ -127,85 +127,6 @@ export default { } }); }, - // syncTableColumns(tableRef) { - // const table = this.$refs[tableRef].$refs.guiptable; - // if (!table) return; - - // // 计算各列宽度 - // const columnWidths = this.calculateColumnWidths(); - // if (!columnWidths) return; - - // this.$nextTick(() => { - // // 1. 设置列定义的宽度 - // table.columns.forEach(column => { - // if (columnWidths[column.property]) { - // column.width = columnWidths[column.property]; - // column.realWidth = columnWidths[column.property]; // 关键:设置realWidth - // } - // }); - - // // 2. 同步DOM元素的宽度 - // const headerCols = table.$el.querySelectorAll('.el-table__header col'); - // const bodyCols = table.$el.querySelectorAll('.el-table__body col'); - // const headerCells = table.$el.querySelectorAll('.el-table__header .cell'); - // // const bodyCells = table.$el.querySelectorAll('.el-table__body .cell'); - - // table.columns.forEach((column, index) => { - // if (columnWidths[column.property]) { - // const width = columnWidths[column.property]; - - // // 同步colgroup中的宽度 - // if (headerCols[index]) { - // headerCols[index].width = width; - // headerCols[index].style.width = `${width}px`; - // } - // if (bodyCols[index]) { - // bodyCols[index].width = width; - // bodyCols[index].style.width = `${width}px`; - // } - - // // 同步单元格的实际宽度 - // if (headerCells[index]) { - // headerCells[index].style.width = `${width}px`; - // } - // // body单元格通常不需要强制设置宽度 - // } - // }); - - // // 3. 强制更新布局 - // table.store.scheduleLayout(); - - // // 4. 处理固定列 - // this.syncFixedColumns(table); - // }); - // }, - - // syncFixedColumns(table) { - // // 处理左侧固定列 - // const fixedLeftWrapper = table.$el.querySelector('.el-table__fixed'); - // if (fixedLeftWrapper) { - // const fixedLeftCols = fixedLeftWrapper.querySelectorAll('col'); - // const originalCols = table.$el.querySelectorAll('.el-table__header col'); - - // fixedLeftCols.forEach((col, index) => { - // if (originalCols[index]) { - // const width = originalCols[index].width; - // col.width = width; - // // col.style.width = `${width}px`; - // col.style.setProperty('width',`${width}px`, 'important'); - - // } - // }); - - // // 强制重绘固定列 - // fixedLeftWrapper.style.display = 'none'; - // this.$nextTick(() => { - // fixedLeftWrapper.style.display = ''; - // }); - // } - - // // 同样处理右侧固定列... - // }, // 销毁观察者