Commit 76ae3e8853e64dc64d138f665b389a1ba4962035
1 parent
5465ae45
fix #5380
Showing
2 changed files
with
14 additions
and
2 deletions
Show diff stats
src/components/table/table-body.vue
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | <table-tr | 8 | <table-tr |
9 | :draggable="draggable" | 9 | :draggable="draggable" |
10 | :row="row" | 10 | :row="row" |
11 | - :key="row._rowKey" | 11 | + :key="rowKey ? row._rowKey : index" |
12 | :prefix-cls="prefixCls" | 12 | :prefix-cls="prefixCls" |
13 | @mouseenter.native.stop="handleMouseIn(row._index)" | 13 | @mouseenter.native.stop="handleMouseIn(row._index)" |
14 | @mouseleave.native.stop="handleMouseOut(row._index)" | 14 | @mouseleave.native.stop="handleMouseOut(row._index)" |
@@ -31,7 +31,7 @@ | @@ -31,7 +31,7 @@ | ||
31 | </table-tr> | 31 | </table-tr> |
32 | <tr v-if="rowExpanded(row._index)" :class="{[prefixCls + '-expanded-hidden']: fixed}"> | 32 | <tr v-if="rowExpanded(row._index)" :class="{[prefixCls + '-expanded-hidden']: fixed}"> |
33 | <td :colspan="columns.length" :class="prefixCls + '-expanded-cell'"> | 33 | <td :colspan="columns.length" :class="prefixCls + '-expanded-cell'"> |
34 | - <Expand :key="row._rowKey" :row="row" :render="expandRender" :index="row._index"></Expand> | 34 | + <Expand :key="rowKey ? row._rowKey : index" :row="row" :render="expandRender" :index="row._index"></Expand> |
35 | </td> | 35 | </td> |
36 | </tr> | 36 | </tr> |
37 | </template> | 37 | </template> |
@@ -63,6 +63,10 @@ | @@ -63,6 +63,10 @@ | ||
63 | draggable: { | 63 | draggable: { |
64 | type: Boolean, | 64 | type: Boolean, |
65 | default: false | 65 | default: false |
66 | + }, | ||
67 | + rowKey: { | ||
68 | + type: Boolean, | ||
69 | + default: false | ||
66 | } | 70 | } |
67 | }, | 71 | }, |
68 | computed: { | 72 | computed: { |
src/components/table/table.vue
@@ -21,6 +21,7 @@ | @@ -21,6 +21,7 @@ | ||
21 | :styleObject="tableStyle" | 21 | :styleObject="tableStyle" |
22 | :columns="cloneColumns" | 22 | :columns="cloneColumns" |
23 | :data="rebuildData" | 23 | :data="rebuildData" |
24 | + :row-key="rowKey" | ||
24 | :columns-width="columnsWidth" | 25 | :columns-width="columnsWidth" |
25 | :obj-data="objData"></table-body> | 26 | :obj-data="objData"></table-body> |
26 | </div> | 27 | </div> |
@@ -59,6 +60,7 @@ | @@ -59,6 +60,7 @@ | ||
59 | :styleObject="fixedTableStyle" | 60 | :styleObject="fixedTableStyle" |
60 | :columns="leftFixedColumns" | 61 | :columns="leftFixedColumns" |
61 | :data="rebuildData" | 62 | :data="rebuildData" |
63 | + :row-key="rowKey" | ||
62 | :columns-width="columnsWidth" | 64 | :columns-width="columnsWidth" |
63 | :obj-data="objData"></table-body> | 65 | :obj-data="objData"></table-body> |
64 | </div> | 66 | </div> |
@@ -84,6 +86,7 @@ | @@ -84,6 +86,7 @@ | ||
84 | :styleObject="fixedRightTableStyle" | 86 | :styleObject="fixedRightTableStyle" |
85 | :columns="rightFixedColumns" | 87 | :columns="rightFixedColumns" |
86 | :data="rebuildData" | 88 | :data="rebuildData" |
89 | + :row-key="rowKey" | ||
87 | :columns-width="columnsWidth" | 90 | :columns-width="columnsWidth" |
88 | :obj-data="objData"></table-body> | 91 | :obj-data="objData"></table-body> |
89 | </div> | 92 | </div> |
@@ -200,6 +203,11 @@ | @@ -200,6 +203,11 @@ | ||
200 | return oneOf(value, ['dark', 'light']); | 203 | return oneOf(value, ['dark', 'light']); |
201 | }, | 204 | }, |
202 | default: 'dark' | 205 | default: 'dark' |
206 | + }, | ||
207 | + // #5380 开启后,:key 强制更新,否则使用 index | ||
208 | + rowKey: { | ||
209 | + type: Boolean, | ||
210 | + default: false | ||
203 | } | 211 | } |
204 | }, | 212 | }, |
205 | data () { | 213 | data () { |