File tree Expand file tree Collapse file tree 4 files changed +35
-4
lines changed Expand file tree Collapse file tree 4 files changed +35
-4
lines changed Original file line number Diff line number Diff line change 1
1
import BodyTr from "./body-tr" ;
2
2
import ExpandTr from "./expand-tr" ;
3
3
import VueDomResizeObserver from "../../../src/comps/resize-observer" ;
4
- import { clsName } from "../util" ;
4
+ import { clsName , getDomResizeObserverCompKey } from "../util" ;
5
5
import { getValByUnit } from "../../../src/utils/index.js" ;
6
6
import emitter from "../../../src/mixins/emitter" ;
7
7
import {
@@ -19,6 +19,10 @@ export default {
19
19
name : COMPS_NAME . VE_TABLE_BODY ,
20
20
mixins : [ emitter ] ,
21
21
props : {
22
+ columnsOptionResetTime : {
23
+ type : Number ,
24
+ default : 0
25
+ } ,
22
26
colgroups : {
23
27
type : Array ,
24
28
required : true
@@ -796,7 +800,10 @@ export default {
796
800
< tr style = "height:0;" >
797
801
{ colgroups . map ( column => {
798
802
const measureTdProps = {
799
- key : column . key ,
803
+ key : getDomResizeObserverCompKey (
804
+ column . key ,
805
+ this . columnsOptionResetTime
806
+ ) ,
800
807
props : {
801
808
tagName : "td" ,
802
809
id : column . key
Original file line number Diff line number Diff line change 1
1
import HeaderTh from "./header-th" ;
2
- import { clsName } from "../util" ;
2
+ import { clsName , getDomResizeObserverCompKey } from "../util" ;
3
3
import { COMPS_NAME , EMIT_EVENTS } from "../util/constant" ;
4
4
import VueDomResizeObserver from "../../../src/comps/resize-observer" ;
5
5
import emitter from "../../../src/mixins/emitter" ;
6
6
export default {
7
7
name : COMPS_NAME . VE_TABLE_THADER_TR ,
8
8
mixins : [ emitter ] ,
9
9
props : {
10
+ columnsOptionResetTime : {
11
+ type : Number ,
12
+ default : 0
13
+ } ,
10
14
// group columns item
11
15
groupColumn : {
12
16
type : Array ,
@@ -148,6 +152,10 @@ export default {
148
152
} ;
149
153
150
154
const trProps = {
155
+ key : getDomResizeObserverCompKey (
156
+ rowIndex ,
157
+ this . columnsOptionResetTime
158
+ ) ,
151
159
class : clsName ( "header-tr" ) ,
152
160
props : {
153
161
tagName : "tr"
Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ import { COMPS_NAME, EMIT_EVENTS } from "../util/constant";
5
5
export default {
6
6
name : COMPS_NAME . VE_TABLE_THADER ,
7
7
props : {
8
+ columnsOptionResetTime : {
9
+ type : Number ,
10
+ default : 0
11
+ } ,
8
12
groupColumns : {
9
13
type : Array ,
10
14
required : true
@@ -137,6 +141,8 @@ export default {
137
141
const trProps = {
138
142
key : rowIndex ,
139
143
props : {
144
+ columnsOptionResetTime : this
145
+ . columnsOptionResetTime ,
140
146
groupColumn,
141
147
headerRows,
142
148
colgroups,
Original file line number Diff line number Diff line change @@ -163,6 +163,11 @@ export default {
163
163
} ,
164
164
data ( ) {
165
165
return {
166
+ /*
167
+ 列配置变化次数
168
+ 依赖columns 配置渲染,都需要重新计算:粘性布局时,重新触发 on-dom-resize-change 事件
169
+ */
170
+ columnsOptionResetTime : 0 ,
166
171
tableContainerRef : "tableContainerRef" ,
167
172
tableContentRef : "tableContentRef" ,
168
173
virtualPhantomRef : "virtualPhantomRef" ,
@@ -409,7 +414,10 @@ export default {
409
414
immediate : true
410
415
} ,
411
416
columns : {
412
- handler ( ) {
417
+ handler ( newVal , oldVal ) {
418
+ if ( newVal != oldVal ) {
419
+ this . columnsOptionResetTime ++ ;
420
+ }
413
421
this . initColumns ( ) ;
414
422
this . initGroupColumns ( ) ;
415
423
} ,
@@ -988,6 +996,7 @@ export default {
988
996
const headerProps = {
989
997
class : clsName ( "header" ) ,
990
998
props : {
999
+ columnsOptionResetTime : this . columnsOptionResetTime ,
991
1000
groupColumns,
992
1001
colgroups,
993
1002
fixedHeader,
@@ -1003,6 +1012,7 @@ export default {
1003
1012
const bodyProps = {
1004
1013
class : [ clsName ( "body" ) , this . tableBodyClass ] ,
1005
1014
props : {
1015
+ columnsOptionResetTime : this . columnsOptionResetTime ,
1006
1016
colgroups,
1007
1017
expandOption,
1008
1018
checkboxOptipon,
You can’t perform that action at this time.
0 commit comments