Commit ade5dbba527dfd0219188c86acc4a2d0803ebd3c

Authored by 梁灏
1 parent 75873f90

fixed #693

examples/routers/table.vue
1 1 <template>
2 2 <div>
3   - <Table highlight-row :columns="columns3" :data="data1" ref="table" @on-current-change="handleChange"></Table>
  3 + <Table highlight-row :columns="columns3" :data="data1" ref="table" @on-current-change="handleChange" @on-row-click="rc"></Table>
4 4 <Button @click="handleClear">clear</Button>
5 5 </div>
6 6 </template>
... ... @@ -20,7 +20,8 @@
20 20 },
21 21 {
22 22 title: '年龄',
23   - key: 'age'
  23 + key: 'age',
  24 + sortable: true
24 25 },
25 26 {
26 27 title: '地址',
... ... @@ -56,7 +57,10 @@
56 57 this.$refs.table.clearCurrentRow();
57 58 },
58 59 handleChange (newData, oldData) {
59   - console.log(newData, oldData)
  60 +// console.log(newData, oldData)
  61 + },
  62 + rc (data, index) {
  63 + console.log(data, index);
60 64 }
61 65 }
62 66 }
... ...
src/components/table/table.vue
... ... @@ -398,11 +398,11 @@
398 398 },
399 399 clickCurrentRow (_index) {
400 400 this.highlightCurrentRow (_index);
401   - this.$emit('on-row-click', JSON.parse(JSON.stringify(this.cloneData[_index])));
  401 + this.$emit('on-row-click', JSON.parse(JSON.stringify(this.cloneData[_index])), _index);
402 402 },
403 403 dblclickCurrentRow (_index) {
404 404 this.highlightCurrentRow (_index);
405   - this.$emit('on-row-dblclick', JSON.parse(JSON.stringify(this.cloneData[_index])));
  405 + this.$emit('on-row-dblclick', JSON.parse(JSON.stringify(this.cloneData[_index])), _index);
406 406 },
407 407 getSelection () {
408 408 let selectionIndexes = [];
... ...