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 | 23 | // align: 'center' |
24 | 24 | // }, |
25 | 25 | { |
26 | - title: '姓名', | |
26 | + title: '姓名姓名姓名姓名姓名姓名姓名姓名姓名姓名姓名姓名', | |
27 | 27 | key: 'name', |
28 | - width: 100, | |
28 | + width: 200, | |
29 | 29 | // sortable: true, |
30 | 30 | // fixed: 'right', |
31 | 31 | render: (h, params) => { |
... | ... | @@ -46,14 +46,14 @@ |
46 | 46 | title: '年龄', |
47 | 47 | key: 'age', |
48 | 48 | sortable: true, |
49 | - width: 100 | |
49 | + width: 200 | |
50 | 50 | }, |
51 | 51 | { |
52 | 52 | title: '省份', |
53 | 53 | key: 'province', |
54 | 54 | sortable: true, |
55 | 55 | // fixed: 'right', |
56 | -// width: 100 | |
56 | + width: 200 | |
57 | 57 | }, |
58 | 58 | // { |
59 | 59 | // title: '市区', | ... | ... |
src/components/table/table.vue
... | ... | @@ -723,9 +723,13 @@ |
723 | 723 | watch: { |
724 | 724 | data: { |
725 | 725 | handler () { |
726 | + const oldDataLen = this.rebuildData.length; | |
726 | 727 | this.objData = this.makeObjData(); |
727 | 728 | this.rebuildData = this.makeDataWithSortAndFilter(); |
728 | 729 | this.handleResize(); |
730 | + if (!oldDataLen) { | |
731 | + this.fixedHeader(); | |
732 | + } | |
729 | 733 | // here will trigger before clickCurrentRow, so use async |
730 | 734 | setTimeout(() => { |
731 | 735 | this.cloneData = deepCopy(this.data); | ... | ... |