This commit is contained in:
梁灏 2019-04-08 17:52:50 +08:00
parent 574ec50425
commit 72979a782a
2 changed files with 24 additions and 4 deletions

View file

@ -149,6 +149,10 @@
height: {
type: [Number, String]
},
// 3.4.0
maxHeight: {
type: [Number, String]
},
stripe: {
type: Boolean,
default: false
@ -275,6 +279,10 @@
const height = parseInt(this.height);
style.height = `${height}px`;
}
if (this.maxHeight) {
const maxHeight = parseInt(this.maxHeight);
style.maxHeight = `${maxHeight}px`;
}
if (this.width) style.width = `${this.width}px`;
return style;
},
@ -336,7 +344,11 @@
let style = {};
if (this.bodyHeight !== 0) {
const height = this.bodyHeight;
style.height = `${height}px`;
if (this.height) {
style.height = `${height}px`;
} else if (this.maxHeight) {
style.maxHeight = `${height}px`;
}
}
return style;
},
@ -548,7 +560,7 @@
this.objData[_index]._isExpanded = status;
this.$emit('on-expand', JSON.parse(JSON.stringify(this.cloneData[_index])), status);
if(this.height){
if(this.height || this.maxHeight){
this.$nextTick(()=>this.fixedBody());
}
},
@ -578,12 +590,16 @@
},
fixedHeader () {
if (this.height) {
if (this.height || this.maxHeight) {
this.$nextTick(() => {
const titleHeight = parseInt(getStyle(this.$refs.title, 'height')) || 0;
const headerHeight = parseInt(getStyle(this.$refs.header, 'height')) || 0;
const footerHeight = parseInt(getStyle(this.$refs.footer, 'height')) || 0;
this.bodyHeight = this.height - titleHeight - headerHeight - footerHeight;
if (this.height) {
this.bodyHeight = this.height - titleHeight - headerHeight - footerHeight;
} else if (this.maxHeight) {
this.bodyHeight = this.maxHeight - titleHeight - headerHeight - footerHeight;
}
this.$nextTick(()=>this.fixedBody());
});
} else {
@ -986,6 +1002,9 @@
height () {
this.handleResize();
},
maxHeight () {
this.handleResize();
},
showHorizontalScrollBar () {
this.handleResize();
},

View file

@ -7,6 +7,7 @@
border: 1px solid @border-color-base;
border-bottom: 0;
border-right: 0;
overflow: hidden; // 开启 max-height 时,没有 overflow: hidden则底部多出 1px早期没有 overflow 是因为有些控件没有加 transfer
}
width: inherit;
height: 100%;