Commit 119eeafedea02d984650b82920abdcdf4e809f79
1 parent
9a0757e3
fixed a Table bug
Showing
2 changed files
with
8 additions
and
4 deletions
Show diff stats
examples/routers/table.vue
@@ -23,9 +23,9 @@ | @@ -23,9 +23,9 @@ | ||
23 | // align: 'center' | 23 | // align: 'center' |
24 | // }, | 24 | // }, |
25 | { | 25 | { |
26 | - title: '姓名', | 26 | + title: '姓名姓名姓名姓名姓名姓名姓名姓名姓名姓名姓名姓名', |
27 | key: 'name', | 27 | key: 'name', |
28 | - width: 100, | 28 | + width: 200, |
29 | // sortable: true, | 29 | // sortable: true, |
30 | // fixed: 'right', | 30 | // fixed: 'right', |
31 | render: (h, params) => { | 31 | render: (h, params) => { |
@@ -46,14 +46,14 @@ | @@ -46,14 +46,14 @@ | ||
46 | title: '年龄', | 46 | title: '年龄', |
47 | key: 'age', | 47 | key: 'age', |
48 | sortable: true, | 48 | sortable: true, |
49 | - width: 100 | 49 | + width: 200 |
50 | }, | 50 | }, |
51 | { | 51 | { |
52 | title: '省份', | 52 | title: '省份', |
53 | key: 'province', | 53 | key: 'province', |
54 | sortable: true, | 54 | sortable: true, |
55 | // fixed: 'right', | 55 | // fixed: 'right', |
56 | -// width: 100 | 56 | + width: 200 |
57 | }, | 57 | }, |
58 | // { | 58 | // { |
59 | // title: '市区', | 59 | // title: '市区', |
src/components/table/table.vue
@@ -723,9 +723,13 @@ | @@ -723,9 +723,13 @@ | ||
723 | watch: { | 723 | watch: { |
724 | data: { | 724 | data: { |
725 | handler () { | 725 | handler () { |
726 | + const oldDataLen = this.rebuildData.length; | ||
726 | this.objData = this.makeObjData(); | 727 | this.objData = this.makeObjData(); |
727 | this.rebuildData = this.makeDataWithSortAndFilter(); | 728 | this.rebuildData = this.makeDataWithSortAndFilter(); |
728 | this.handleResize(); | 729 | this.handleResize(); |
730 | + if (!oldDataLen) { | ||
731 | + this.fixedHeader(); | ||
732 | + } | ||
729 | // here will trigger before clickCurrentRow, so use async | 733 | // here will trigger before clickCurrentRow, so use async |
730 | setTimeout(() => { | 734 | setTimeout(() => { |
731 | this.cloneData = deepCopy(this.data); | 735 | this.cloneData = deepCopy(this.data); |