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

@ -10,6 +10,7 @@
<!-- <br><br><br><br><br> --> <!-- <br><br><br><br><br> -->
<!-- <Table border :columns="columns6" :data="data5"></Table> --> <!-- <Table border :columns="columns6" :data="data5"></Table> -->
<!-- <br><br><br><br><br> --> <!-- <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> <Table border :columns="columns7" height="240" :data="data7"></Table>
<!-- <br><br><br><br><br> --> <!-- <br><br><br><br><br> -->
<!-- <Table border :columns="columns8" :data="data7" height="200"></Table> --> <!-- <Table border :columns="columns8" :data="data7" height="200"></Table> -->

View file

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

View file

@ -573,9 +573,13 @@
} }
}, },
fixedBody (){ fixedBody (){
if (this.$refs.header) {
this.headerWidth = this.$refs.header.children[0].offsetWidth; this.headerWidth = this.$refs.header.children[0].offsetWidth;
this.headerHeight = this.$refs.header.children[0].offsetHeight; this.headerHeight = this.$refs.header.children[0].offsetHeight;
this.showHorizontalScrollBar = this.headerWidth>this.$refs.header.offsetWidth; this.showHorizontalScrollBar = this.headerWidth>this.$refs.header.offsetWidth;
}
if (!this.$refs.tbody || !this.data || this.data.length === 0) { if (!this.$refs.tbody || !this.data || this.data.length === 0) {
this.showVerticalScrollBar = false; this.showVerticalScrollBar = false;
} }
@ -585,6 +589,10 @@
let bodyContentHeight = bodyContentEl.offsetHeight; let bodyContentHeight = bodyContentEl.offsetHeight;
let bodyHeight = bodyEl.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; this.showVerticalScrollBar = this.bodyHeight? bodyHeight - (this.showHorizontalScrollBar?this.scrollBarWidth:0) < bodyContentHeight : false;
if(this.showVerticalScrollBar){ if(this.showVerticalScrollBar){