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 11import BodyTr from "./body-tr" ;
22import ExpandTr from "./expand-tr" ;
33import VueDomResizeObserver from "../../../src/comps/resize-observer" ;
4- import { clsName } from "../util" ;
4+ import { clsName , getDomResizeObserverCompKey } from "../util" ;
55import { getValByUnit } from "../../../src/utils/index.js" ;
66import emitter from "../../../src/mixins/emitter" ;
77import {
@@ -19,6 +19,10 @@ export default {
1919 name : COMPS_NAME . VE_TABLE_BODY ,
2020 mixins : [ emitter ] ,
2121 props : {
22+ columnsOptionResetTime : {
23+ type : Number ,
24+ default : 0
25+ } ,
2226 colgroups : {
2327 type : Array ,
2428 required : true
@@ -796,7 +800,10 @@ export default {
796800 < tr style = "height:0;" >
797801 { colgroups . map ( column => {
798802 const measureTdProps = {
799- key : column . key ,
803+ key : getDomResizeObserverCompKey (
804+ column . key ,
805+ this . columnsOptionResetTime
806+ ) ,
800807 props : {
801808 tagName : "td" ,
802809 id : column . key
Original file line number Diff line number Diff line change 11import HeaderTh from "./header-th" ;
2- import { clsName } from "../util" ;
2+ import { clsName , getDomResizeObserverCompKey } from "../util" ;
33import { COMPS_NAME , EMIT_EVENTS } from "../util/constant" ;
44import VueDomResizeObserver from "../../../src/comps/resize-observer" ;
55import emitter from "../../../src/mixins/emitter" ;
66export default {
77 name : COMPS_NAME . VE_TABLE_THADER_TR ,
88 mixins : [ emitter ] ,
99 props : {
10+ columnsOptionResetTime : {
11+ type : Number ,
12+ default : 0
13+ } ,
1014 // group columns item
1115 groupColumn : {
1216 type : Array ,
@@ -148,6 +152,10 @@ export default {
148152 } ;
149153
150154 const trProps = {
155+ key : getDomResizeObserverCompKey (
156+ rowIndex ,
157+ this . columnsOptionResetTime
158+ ) ,
151159 class : clsName ( "header-tr" ) ,
152160 props : {
153161 tagName : "tr"
Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ import { COMPS_NAME, EMIT_EVENTS } from "../util/constant";
55export default {
66 name : COMPS_NAME . VE_TABLE_THADER ,
77 props : {
8+ columnsOptionResetTime : {
9+ type : Number ,
10+ default : 0
11+ } ,
812 groupColumns : {
913 type : Array ,
1014 required : true
@@ -137,6 +141,8 @@ export default {
137141 const trProps = {
138142 key : rowIndex ,
139143 props : {
144+ columnsOptionResetTime : this
145+ . columnsOptionResetTime ,
140146 groupColumn,
141147 headerRows,
142148 colgroups,
Original file line number Diff line number Diff line change @@ -163,6 +163,11 @@ export default {
163163 } ,
164164 data ( ) {
165165 return {
166+ /*
167+ 列配置变化次数
168+ 依赖columns 配置渲染,都需要重新计算:粘性布局时,重新触发 on-dom-resize-change 事件
169+ */
170+ columnsOptionResetTime : 0 ,
166171 tableContainerRef : "tableContainerRef" ,
167172 tableContentRef : "tableContentRef" ,
168173 virtualPhantomRef : "virtualPhantomRef" ,
@@ -409,7 +414,10 @@ export default {
409414 immediate : true
410415 } ,
411416 columns : {
412- handler ( ) {
417+ handler ( newVal , oldVal ) {
418+ if ( newVal != oldVal ) {
419+ this . columnsOptionResetTime ++ ;
420+ }
413421 this . initColumns ( ) ;
414422 this . initGroupColumns ( ) ;
415423 } ,
@@ -988,6 +996,7 @@ export default {
988996 const headerProps = {
989997 class : clsName ( "header" ) ,
990998 props : {
999+ columnsOptionResetTime : this . columnsOptionResetTime ,
9911000 groupColumns,
9921001 colgroups,
9931002 fixedHeader,
@@ -1003,6 +1012,7 @@ export default {
10031012 const bodyProps = {
10041013 class : [ clsName ( "body" ) , this . tableBodyClass ] ,
10051014 props : {
1015+ columnsOptionResetTime : this . columnsOptionResetTime ,
10061016 colgroups,
10071017 expandOption,
10081018 checkboxOptipon,
You can’t perform that action at this time.
0 commit comments