@@ -10,7 +10,7 @@ export default {
10
10
resizeColumns : [ ] , // 所有需要自适应的列集合
11
11
initTotalColumnsWidth : 0 , // 所有列初始化时的总宽度
12
12
hasContainerWidth : false , // 容器是否有宽度(display:none 时没有)
13
- containerWidthCheckTimer :null
13
+ containerWidthCheckTimer : null
14
14
}
15
15
} ,
16
16
@@ -41,12 +41,12 @@ export default {
41
41
// 如果初始化时document上包含滚动条,渲染完document滚动条消失会造成表格宽度计算有误的问题
42
42
containerWidthCheck ( ) {
43
43
44
- this . containerWidthCheckTimer = setTimeout ( x => {
44
+ this . containerWidthCheckTimer = setTimeout ( x => {
45
45
46
46
let tableContainerWidth = this . $el . clientWidth ;
47
47
48
48
// 3为容错值
49
- if ( tableContainerWidth - this . internalWidth > 3 ) {
49
+ if ( tableContainerWidth - this . internalWidth > 3 ) {
50
50
51
51
this . tableResize ( ) ;
52
52
}
@@ -110,41 +110,36 @@ export default {
110
110
return false ;
111
111
}
112
112
113
- var self = this ,
114
- maxWidth = self . maxWidth ,
115
- maxHeight = ( self . height && self . height > 0 ) ? self . height : this . getTotalColumnsHeight ( ) ,
116
- minWidth = self . minWidth ,
117
- minHeight = self . minHeight ,
113
+ var totalColumnsHeight = this . getTotalColumnsHeight ( ) ,
114
+ maxWidth = this . maxWidth ,
115
+ maxHeight = ( this . height && this . height > 0 ) ? this . height : totalColumnsHeight ,
116
+ minWidth = this . minWidth ,
117
+ minHeight = this . minHeight > totalColumnsHeight ? totalColumnsHeight : this . minHeight ,
118
118
view = this . $el ,
119
119
viewOffset = utils . getViewportOffset ( view ) ,
120
120
currentWidth = view . getBoundingClientRect !== 'undefined' ? view . getBoundingClientRect ( ) . width : view . clientWidth ,
121
121
currentHeight = view . getBoundingClientRect !== 'undefined' ? view . getBoundingClientRect ( ) . height : view . clientHeight ,
122
- right = window . document . documentElement . clientWidth - currentWidth - viewOffset . left ,
122
+ // right = window.document.documentElement.clientWidth - currentWidth - viewOffset.left,
123
123
bottom = window . document . documentElement . clientHeight - currentHeight - viewOffset . top - 2 ; //
124
124
125
125
126
- if ( self . isVerticalResize && currentHeight > 0 ) {
127
- // (窗口高度缩小 && 当前高度大于最小高度) || (窗口高度扩大 && 当前高度小于最大高度)
128
- bottom -= self . verticalResizeOffset ;
129
- if ( ( currentHeight > minHeight ) || ( currentHeight < maxHeight ) ) {
130
- var currentHeight = currentHeight + bottom ; // - self.VerticalResizeOffset;
131
- currentHeight = currentHeight > maxHeight ? maxHeight : currentHeight ;
132
- currentHeight = currentHeight < minHeight ? minHeight : currentHeight ;
133
- self . internalHeight = currentHeight ;
134
- }
135
- }
126
+ if ( this . isVerticalResize && currentHeight > 0 ) {
136
127
137
- if ( self . isHorizontalResize && self . internalWidth && self . internalWidth > 0 && currentWidth > 0 ) {
128
+ bottom -= this . verticalResizeOffset ;
138
129
139
- // (窗口宽度缩小 && 当前宽度大于最小宽度) ||(窗口宽度扩大 && 当前宽度小于最大宽度)
140
- if ( ( right <= 0 && currentWidth > minWidth ) || ( right >= 0 && currentWidth < maxWidth ) ) {
130
+ currentHeight = currentHeight + bottom ; // - this.VerticalResizeOffset;
131
+ currentHeight = currentHeight > maxHeight ? maxHeight : currentHeight ;
132
+ currentHeight = currentHeight < minHeight ? minHeight : currentHeight ;
133
+ this . internalHeight = currentHeight ;
134
+ }
141
135
142
- currentWidth = currentWidth > maxWidth ? maxWidth : currentWidth ;
143
- currentWidth = currentWidth < minWidth ? minWidth : currentWidth ;
136
+ if ( this . isHorizontalResize && this . internalWidth && this . internalWidth > 0 && currentWidth > 0 ) {
144
137
145
- self . internalWidth = currentWidth ;
146
- self . changeColumnsWidth ( currentWidth ) ;
147
- }
138
+ currentWidth = currentWidth > maxWidth ? maxWidth : currentWidth ;
139
+ currentWidth = currentWidth < minWidth ? minWidth : currentWidth ;
140
+
141
+ this . internalWidth = currentWidth ;
142
+ this . changeColumnsWidth ( currentWidth ) ;
148
143
}
149
144
} ,
150
145
0 commit comments