fix: problem of props rowKey in StandardTable.vue; 🐛

修复:StandardTable.vue props 属性 rowKey 的bug;
master
iczer 4 years ago
parent ebb9d19ccd
commit 680300e4e6
  1. 17
      src/components/table/StandardTable.vue

@ -36,7 +36,18 @@
<script> <script>
export default { export default {
name: 'StandardTable', name: 'StandardTable',
props: ['bordered', 'loading', 'columns', 'dataSource', 'rowKey', 'pagination', 'selectedRows'], props: {
bordered: Boolean,
loading: [Boolean, Object],
columns: Array,
dataSource: Array,
rowKey: {
type: [String, Function],
default: 'key'
},
pagination: Object,
selectedRows: Array
},
data () { data () {
return { return {
needTotalList: [], needTotalList: [],
@ -99,7 +110,9 @@ export default {
}, },
computed: { computed: {
selectedRowKeys() { selectedRowKeys() {
return this.selectedRows.map(row => row.key) return this.selectedRows.map(record => {
return (typeof this.rowKey === 'function') ? this.rowKey(record) : record[this.rowKey]
})
} }
} }
} }

Loading…
Cancel
Save