File tree Expand file tree Collapse file tree 1 file changed +18
-8
lines changed
Expand file tree Collapse file tree 1 file changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -77,17 +77,27 @@ export default defineComponent({
7777 // 单行表格合并
7878 const colspanSkipMap = computed ( ( ) => {
7979 const map : { [ key : string ] : boolean } = { } ;
80- const list = props . thList [ 0 ] ;
81- for ( let i = 0 , len = list . length ; i < len ; i ++ ) {
82- const item = list [ i ] ;
83- if ( item . colspan > 1 ) {
84- for ( let j = i + 1 ; j < i + item . colspan ; j ++ ) {
85- if ( list [ j ] ) {
86- map [ list [ j ] . colKey ] = true ;
80+
81+ const processColumns = ( columns : BaseTableColumns ) => {
82+ for ( let i = 0 , len = columns . length ; i < len ; i ++ ) {
83+ const item = columns [ i ] ;
84+ if ( item . colspan > 1 ) {
85+ for ( let j = i + 1 ; j < i + item . colspan ; j ++ ) {
86+ if ( columns [ j ] ) {
87+ map [ columns [ j ] . colKey ] = true ;
88+ }
8789 }
8890 }
91+ // 如果有子列,递归处理
92+ if ( item . children ) {
93+ processColumns ( item . children ) ;
94+ }
8995 }
90- }
96+ } ;
97+
98+ const list = props . thList [ 0 ] ;
99+ processColumns ( list ) ;
100+
91101 return map ;
92102 } ) ;
93103
You can’t perform that action at this time.
0 commit comments