Commit ade5dbba527dfd0219188c86acc4a2d0803ebd3c
1 parent
75873f90
fixed #693
Showing
2 changed files
with
9 additions
and
5 deletions
Show diff stats
examples/routers/table.vue
1 | <template> | 1 | <template> |
2 | <div> | 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 | <Button @click="handleClear">clear</Button> | 4 | <Button @click="handleClear">clear</Button> |
5 | </div> | 5 | </div> |
6 | </template> | 6 | </template> |
@@ -20,7 +20,8 @@ | @@ -20,7 +20,8 @@ | ||
20 | }, | 20 | }, |
21 | { | 21 | { |
22 | title: '年龄', | 22 | title: '年龄', |
23 | - key: 'age' | 23 | + key: 'age', |
24 | + sortable: true | ||
24 | }, | 25 | }, |
25 | { | 26 | { |
26 | title: '地址', | 27 | title: '地址', |
@@ -56,7 +57,10 @@ | @@ -56,7 +57,10 @@ | ||
56 | this.$refs.table.clearCurrentRow(); | 57 | this.$refs.table.clearCurrentRow(); |
57 | }, | 58 | }, |
58 | handleChange (newData, oldData) { | 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,11 +398,11 @@ | ||
398 | }, | 398 | }, |
399 | clickCurrentRow (_index) { | 399 | clickCurrentRow (_index) { |
400 | this.highlightCurrentRow (_index); | 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 | dblclickCurrentRow (_index) { | 403 | dblclickCurrentRow (_index) { |
404 | this.highlightCurrentRow (_index); | 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 | getSelection () { | 407 | getSelection () { |
408 | let selectionIndexes = []; | 408 | let selectionIndexes = []; |