Commit f1dfa8ffab9ebacd028c0ff75664b1f24e8ed3e2
1 parent
060c7958
fixed table show-header=false bug
Showing
3 changed files
with
15 additions
and
5 deletions
Show diff stats
examples/routers/table.vue
1 | <template> | 1 | <template> |
2 | <div> | 2 | <div> |
3 | <br><br><br><br><br> | 3 | <br><br><br><br><br> |
4 | - <Table border :columns="columns1" height="500" :data="data1"></Table> | 4 | + <Table border :columns="columns1" height="500" :data="data1"></Table> |
5 | <!-- <Table border :columns="columns1" height='300'></Table> --> | 5 | <!-- <Table border :columns="columns1" height='300'></Table> --> |
6 | <!-- <br><br><br><br><br> --> | 6 | <!-- <br><br><br><br><br> --> |
7 | <!-- <Table width="550" height="200" border :columns="columns2" :data="data4"></Table> --> | 7 | <!-- <Table width="550" height="200" border :columns="columns2" :data="data4"></Table> --> |
@@ -10,6 +10,7 @@ | @@ -10,6 +10,7 @@ | ||
10 | <!-- <br><br><br><br><br> --> | 10 | <!-- <br><br><br><br><br> --> |
11 | <!-- <Table border :columns="columns6" :data="data5"></Table> --> | 11 | <!-- <Table border :columns="columns6" :data="data5"></Table> --> |
12 | <!-- <br><br><br><br><br> --> | 12 | <!-- <br><br><br><br><br> --> |
13 | + <Table border :show-header='false' :columns="columns7" height="200" :data="data7"></Table> | ||
13 | <Table border :columns="columns7" height="240" :data="data7"></Table> | 14 | <Table border :columns="columns7" height="240" :data="data7"></Table> |
14 | <!-- <br><br><br><br><br> --> | 15 | <!-- <br><br><br><br><br> --> |
15 | <!-- <Table border :columns="columns8" :data="data7" height="200"></Table> --> | 16 | <!-- <Table border :columns="columns8" :data="data7" height="200"></Table> --> |
package.json
@@ -20,6 +20,7 @@ | @@ -20,6 +20,7 @@ | ||
20 | ], | 20 | ], |
21 | "scripts": { | 21 | "scripts": { |
22 | "dev": "webpack-dev-server --content-base test/ --open --inline --hot --compress --history-api-fallback --port 8081 --config build/webpack.dev.config.js", | 22 | "dev": "webpack-dev-server --content-base test/ --open --inline --hot --compress --history-api-fallback --port 8081 --config build/webpack.dev.config.js", |
23 | + "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", | ||
23 | "dist:style": "gulp --gulpfile build/build-style.js", | 24 | "dist:style": "gulp --gulpfile build/build-style.js", |
24 | "dist:dev": "webpack --config build/webpack.dist.dev.config.js", | 25 | "dist:dev": "webpack --config build/webpack.dist.dev.config.js", |
25 | "dist:prod": "webpack --config build/webpack.dist.prod.config.js", | 26 | "dist:prod": "webpack --config build/webpack.dist.prod.config.js", |
src/components/table/table.vue
@@ -573,9 +573,13 @@ | @@ -573,9 +573,13 @@ | ||
573 | } | 573 | } |
574 | }, | 574 | }, |
575 | fixedBody (){ | 575 | fixedBody (){ |
576 | - this.headerWidth = this.$refs.header.children[0].offsetWidth; | ||
577 | - this.headerHeight = this.$refs.header.children[0].offsetHeight; | ||
578 | - this.showHorizontalScrollBar = this.headerWidth>this.$refs.header.offsetWidth; | 576 | + if (this.$refs.header) { |
577 | + this.headerWidth = this.$refs.header.children[0].offsetWidth; | ||
578 | + this.headerHeight = this.$refs.header.children[0].offsetHeight; | ||
579 | + this.showHorizontalScrollBar = this.headerWidth>this.$refs.header.offsetWidth; | ||
580 | + | ||
581 | + } | ||
582 | + | ||
579 | if (!this.$refs.tbody || !this.data || this.data.length === 0) { | 583 | if (!this.$refs.tbody || !this.data || this.data.length === 0) { |
580 | this.showVerticalScrollBar = false; | 584 | this.showVerticalScrollBar = false; |
581 | } | 585 | } |
@@ -584,6 +588,10 @@ | @@ -584,6 +588,10 @@ | ||
584 | let bodyEl = bodyContentEl.parentElement; | 588 | let bodyEl = bodyContentEl.parentElement; |
585 | let bodyContentHeight = bodyContentEl.offsetHeight; | 589 | let bodyContentHeight = bodyContentEl.offsetHeight; |
586 | let bodyHeight = bodyEl.offsetHeight; | 590 | let bodyHeight = bodyEl.offsetHeight; |
591 | + | ||
592 | + if (!this.$refs.header) { | ||
593 | + this.showHorizontalScrollBar = bodyEl.offsetWidth < bodyContentEl.offsetWidth; | ||
594 | + } | ||
587 | 595 | ||
588 | this.showVerticalScrollBar = this.bodyHeight? bodyHeight - (this.showHorizontalScrollBar?this.scrollBarWidth:0) < bodyContentHeight : false; | 596 | this.showVerticalScrollBar = this.bodyHeight? bodyHeight - (this.showHorizontalScrollBar?this.scrollBarWidth:0) < bodyContentHeight : false; |
589 | 597 | ||
@@ -597,7 +605,7 @@ | @@ -597,7 +605,7 @@ | ||
597 | }else{ | 605 | }else{ |
598 | bodyEl.classList.remove(this.prefixCls +'-overflowX'); | 606 | bodyEl.classList.remove(this.prefixCls +'-overflowX'); |
599 | } | 607 | } |
600 | - } | 608 | + } |
601 | }, | 609 | }, |
602 | 610 | ||
603 | hideColumnFilter () { | 611 | hideColumnFilter () { |