This commit is contained in:
梁灏 2019-04-09 08:58:29 +08:00
parent 5465ae45f7
commit 76ae3e8853
2 changed files with 14 additions and 2 deletions

View file

@ -8,7 +8,7 @@
<table-tr <table-tr
:draggable="draggable" :draggable="draggable"
:row="row" :row="row"
:key="row._rowKey" :key="rowKey ? row._rowKey : index"
:prefix-cls="prefixCls" :prefix-cls="prefixCls"
@mouseenter.native.stop="handleMouseIn(row._index)" @mouseenter.native.stop="handleMouseIn(row._index)"
@mouseleave.native.stop="handleMouseOut(row._index)" @mouseleave.native.stop="handleMouseOut(row._index)"
@ -31,7 +31,7 @@
</table-tr> </table-tr>
<tr v-if="rowExpanded(row._index)" :class="{[prefixCls + '-expanded-hidden']: fixed}"> <tr v-if="rowExpanded(row._index)" :class="{[prefixCls + '-expanded-hidden']: fixed}">
<td :colspan="columns.length" :class="prefixCls + '-expanded-cell'"> <td :colspan="columns.length" :class="prefixCls + '-expanded-cell'">
<Expand :key="row._rowKey" :row="row" :render="expandRender" :index="row._index"></Expand> <Expand :key="rowKey ? row._rowKey : index" :row="row" :render="expandRender" :index="row._index"></Expand>
</td> </td>
</tr> </tr>
</template> </template>
@ -63,6 +63,10 @@
draggable: { draggable: {
type: Boolean, type: Boolean,
default: false default: false
},
rowKey: {
type: Boolean,
default: false
} }
}, },
computed: { computed: {

View file

@ -21,6 +21,7 @@
:styleObject="tableStyle" :styleObject="tableStyle"
:columns="cloneColumns" :columns="cloneColumns"
:data="rebuildData" :data="rebuildData"
:row-key="rowKey"
:columns-width="columnsWidth" :columns-width="columnsWidth"
:obj-data="objData"></table-body> :obj-data="objData"></table-body>
</div> </div>
@ -59,6 +60,7 @@
:styleObject="fixedTableStyle" :styleObject="fixedTableStyle"
:columns="leftFixedColumns" :columns="leftFixedColumns"
:data="rebuildData" :data="rebuildData"
:row-key="rowKey"
:columns-width="columnsWidth" :columns-width="columnsWidth"
:obj-data="objData"></table-body> :obj-data="objData"></table-body>
</div> </div>
@ -84,6 +86,7 @@
:styleObject="fixedRightTableStyle" :styleObject="fixedRightTableStyle"
:columns="rightFixedColumns" :columns="rightFixedColumns"
:data="rebuildData" :data="rebuildData"
:row-key="rowKey"
:columns-width="columnsWidth" :columns-width="columnsWidth"
:obj-data="objData"></table-body> :obj-data="objData"></table-body>
</div> </div>
@ -200,6 +203,11 @@
return oneOf(value, ['dark', 'light']); return oneOf(value, ['dark', 'light']);
}, },
default: 'dark' default: 'dark'
},
// #5380 :key 使 index
rowKey: {
type: Boolean,
default: false
} }
}, },
data () { data () {