Skip to content

Commit d8579c1

Browse files
committed
优化element升级2.14.1版本后表格错位的问题
1 parent 3c5d6f3 commit d8579c1

File tree

2 files changed

+46
-14
lines changed

2 files changed

+46
-14
lines changed

Vol.Vue/src/components/basic/VolTable.vue

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,9 @@
260260
:color="getColor(scope.row, column)"
261261
>{{ formatter(scope.row, column, true) }}</Tag
262262
>
263-
<template v-else>{{ formatter(scope.row, column, true) }}</template>
263+
<template v-else>{{
264+
formatter(scope.row, column, true)
265+
}}</template>
264266
</template>
265267
</template>
266268
</el-table-column>
@@ -290,11 +292,12 @@ export default {
290292
typeof: String,
291293
default: undefined,
292294
},
293-
loadTreeChildren: {//树形结构加载子节点
295+
loadTreeChildren: {
296+
//树形结构加载子节点
294297
type: Function,
295298
default: (tree, treeNode, resolve) => {
296299
return resolve([]);
297-
}
300+
},
298301
},
299302
textInline: {
300303
//表格内容超出后是否换行显示(2020.01.16)
@@ -473,8 +476,15 @@ export default {
473476
};
474477
},
475478
created() {
476-
this.realHeight = this.getHeight();
477-
this.realMaxHeight = this.getMaxHeight();
479+
//升级element 2.15.1版本后,这个高度有问题,如果有统计求和的table,强制使用max-height属性
480+
if ( this.columns.some(x=>{return x.summary})) {
481+
this.realHeight =null;
482+
this.realMaxHeight = this.maxHeight||this.height;
483+
}else{
484+
this.realHeight = this.getHeight();
485+
this.realMaxHeight = this.getMaxHeight();
486+
}
487+
478488
479489
//从后台加下拉框的[是否启用的]数据源
480490
let keys = [];
@@ -1294,14 +1304,14 @@ export default {
12941304
}
12951305
12961306
.v-table >>> .el-table__footer td {
1297-
padding: 5px 0 !important;
1307+
padding: 7px 0 !important;
12981308
}
12991309
/* 2021.01.30修复火狐checkbox错位问题 */
13001310
.vol-table >>> .el-table-column--selection .cell {
13011311
display: inline;
13021312
}
13031313
.vol-table.text-inline >>> .el-table th > .cell {
1304-
white-space: inherit !important;
1314+
white-space: nowrap !important;
13051315
}
13061316
.vol-table >>> .el-table__body-wrapper::-webkit-scrollbar {
13071317
width: 10px;
@@ -1325,5 +1335,11 @@ export default {
13251335
border: none !important;
13261336
background: none !important;
13271337
}
1338+
.v-table >>> .el-table__fixed-body-wrapper {
1339+
top: 41px !important;
1340+
}
1341+
.v-table >>> .el-table__fixed:before {
1342+
border-color: none !important;
1343+
}
13281344
</style>
13291345

开发版dev/Vue.NetCore/Vol.Vue/src/components/basic/VolTable.vue

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,9 @@
260260
:color="getColor(scope.row, column)"
261261
>{{ formatter(scope.row, column, true) }}</Tag
262262
>
263-
<template v-else>{{ formatter(scope.row, column, true) }}</template>
263+
<template v-else>{{
264+
formatter(scope.row, column, true)
265+
}}</template>
264266
</template>
265267
</template>
266268
</el-table-column>
@@ -290,11 +292,12 @@ export default {
290292
typeof: String,
291293
default: undefined,
292294
},
293-
loadTreeChildren: {//树形结构加载子节点
295+
loadTreeChildren: {
296+
//树形结构加载子节点
294297
type: Function,
295298
default: (tree, treeNode, resolve) => {
296299
return resolve([]);
297-
}
300+
},
298301
},
299302
textInline: {
300303
//表格内容超出后是否换行显示(2020.01.16)
@@ -473,8 +476,15 @@ export default {
473476
};
474477
},
475478
created() {
476-
this.realHeight = this.getHeight();
477-
this.realMaxHeight = this.getMaxHeight();
479+
//升级element 2.15.1版本后,这个高度有问题,如果有统计求和的table,强制使用max-height属性
480+
if ( this.columns.some(x=>{return x.summary})) {
481+
this.realHeight =null;
482+
this.realMaxHeight = this.maxHeight||this.height;
483+
}else{
484+
this.realHeight = this.getHeight();
485+
this.realMaxHeight = this.getMaxHeight();
486+
}
487+
478488
479489
//从后台加下拉框的[是否启用的]数据源
480490
let keys = [];
@@ -1294,14 +1304,14 @@ export default {
12941304
}
12951305
12961306
.v-table >>> .el-table__footer td {
1297-
padding: 5px 0 !important;
1307+
padding: 7px 0 !important;
12981308
}
12991309
/* 2021.01.30修复火狐checkbox错位问题 */
13001310
.vol-table >>> .el-table-column--selection .cell {
13011311
display: inline;
13021312
}
13031313
.vol-table.text-inline >>> .el-table th > .cell {
1304-
white-space: inherit !important;
1314+
white-space: nowrap !important;
13051315
}
13061316
.vol-table >>> .el-table__body-wrapper::-webkit-scrollbar {
13071317
width: 10px;
@@ -1325,5 +1335,11 @@ export default {
13251335
border: none !important;
13261336
background: none !important;
13271337
}
1338+
.v-table >>> .el-table__fixed-body-wrapper {
1339+
top: 41px !important;
1340+
}
1341+
.v-table >>> .el-table__fixed:before {
1342+
border-color: none !important;
1343+
}
13281344
</style>
13291345

0 commit comments

Comments
 (0)