fixed table show-header=false bug

This commit is contained in:
huanghong 2018-04-10 11:01:50 +08:00
parent 060c79588e
commit f1dfa8ffab
3 changed files with 15 additions and 5 deletions

View file

@ -1,7 +1,7 @@
<template>
<div>
<br><br><br><br><br>
<Table border :columns="columns1" height="500" :data="data1"></Table>
<Table border :columns="columns1" height="500" :data="data1"></Table>
<!-- <Table border :columns="columns1" height='300'></Table> -->
<!-- <br><br><br><br><br> -->
<!-- <Table width="550" height="200" border :columns="columns2" :data="data4"></Table> -->
@ -10,6 +10,7 @@
<!-- <br><br><br><br><br> -->
<!-- <Table border :columns="columns6" :data="data5"></Table> -->
<!-- <br><br><br><br><br> -->
<Table border :show-header='false' :columns="columns7" height="200" :data="data7"></Table>
<Table border :columns="columns7" height="240" :data="data7"></Table>
<!-- <br><br><br><br><br> -->
<!-- <Table border :columns="columns8" :data="data7" height="200"></Table> -->

View file

@ -20,6 +20,7 @@
],
"scripts": {
"dev": "webpack-dev-server --content-base test/ --open --inline --hot --compress --history-api-fallback --port 8081 --config build/webpack.dev.config.js",
"dev:s": "webpack-dev-server --content-base test/ --open --inline --hot --compress --history-api-fallback --port 8081 --host 0.0.0.0 --config build/webpack.dev.config.js",
"dist:style": "gulp --gulpfile build/build-style.js",
"dist:dev": "webpack --config build/webpack.dist.dev.config.js",
"dist:prod": "webpack --config build/webpack.dist.prod.config.js",

View file

@ -573,9 +573,13 @@
}
},
fixedBody (){
this.headerWidth = this.$refs.header.children[0].offsetWidth;
this.headerHeight = this.$refs.header.children[0].offsetHeight;
this.showHorizontalScrollBar = this.headerWidth>this.$refs.header.offsetWidth;
if (this.$refs.header) {
this.headerWidth = this.$refs.header.children[0].offsetWidth;
this.headerHeight = this.$refs.header.children[0].offsetHeight;
this.showHorizontalScrollBar = this.headerWidth>this.$refs.header.offsetWidth;
}
if (!this.$refs.tbody || !this.data || this.data.length === 0) {
this.showVerticalScrollBar = false;
}
@ -584,6 +588,10 @@
let bodyEl = bodyContentEl.parentElement;
let bodyContentHeight = bodyContentEl.offsetHeight;
let bodyHeight = bodyEl.offsetHeight;
if (!this.$refs.header) {
this.showHorizontalScrollBar = bodyEl.offsetWidth < bodyContentEl.offsetWidth;
}
this.showVerticalScrollBar = this.bodyHeight? bodyHeight - (this.showHorizontalScrollBar?this.scrollBarWidth:0) < bodyContentHeight : false;
@ -597,7 +605,7 @@
}else{
bodyEl.classList.remove(this.prefixCls +'-overflowX');
}
}
}
},
hideColumnFilter () {