@@ -139,7 +139,6 @@ const setLeftOrRightPosition = ({ columnList, direction, headerEl, bodyEl, scrol
139139 const ths = headerEl ?. querySelectorAll ( `[data-colid=${ column . id } ]` ) || [ ]
140140 const tds = bodyEl . querySelectorAll ( `[data-colid=${ column . id } ]` )
141141 const allFixed = [ ...Array . from ( ths ) , ...Array . from ( tds ) ]
142-
143142 allFixed . forEach ( ( td ) => {
144143 // 有纵向滚动条时,表头右冻结列需要补偿right定位
145144 let compensatingWidth = 0
@@ -161,7 +160,7 @@ const setLeftOrRightPosition = ({ columnList, direction, headerEl, bodyEl, scrol
161160const setGroupHeaderPosition = ( { columnChart, direction } ) => {
162161 // 这里需要浅拷贝一份,避免改变原始数据的顺序
163162 const colChart = columnChart . slice ( )
164-
163+ const finishColumns = new Set ( )
165164 // 如果是右测冻结则需要反转数组后再进行循环
166165 if ( direction === 'right' ) {
167166 colChart . reverse ( )
@@ -177,11 +176,15 @@ const setGroupHeaderPosition = ({ columnChart, direction }) => {
177176 const leafDirectionPos = leafColumn ?. style ?. [ direction ] ?? null
178177
179178 if ( leafDirectionPos !== null ) {
180- columns . forEach ( ( column ) => {
179+ columns . forEach ( ( column , index ) => {
180+ // 叶子节点则返回
181+ if ( index === columns . length - 1 ) {
182+ return
183+ }
181184 column . style = column . style || { }
182- const pos = column . style [ direction ] ?? null
183- if ( pos === null ) {
185+ if ( ! finishColumns . has ( column . id ) ) {
184186 column . style [ direction ] = leafDirectionPos
187+ finishColumns . add ( column . id )
185188 }
186189 } )
187190 }
0 commit comments