diff --git a/examples/routers/table.vue b/examples/routers/table.vue index e4a0191..2639c9a 100644 --- a/examples/routers/table.vue +++ b/examples/routers/table.vue @@ -1,5 +1,5 @@ <template> - <Table border :columns="columns5" :data="data5"></Table> + <Table border :columns="columns5" :data="data5" @on-select="onSelect(true)" @on-select-cancel="onSelect(false)"></Table> </template> <script> import etable from '../components/table.vue'; @@ -9,6 +9,11 @@ return { columns5: [ { + type: 'selection', + width: 60, + align: 'center' + }, + { type: 'expand', render: (h) => { console.log('______hover______'); @@ -73,6 +78,12 @@ }, ] } + }, + + methods: { + onSelect (value) { + window.alert(value); + } } } </script> diff --git a/src/components/table/table.vue b/src/components/table/table.vue index eac3309..555d0cc 100644 --- a/src/components/table/table.vue +++ b/src/components/table/table.vue @@ -404,9 +404,7 @@ this.objData[_index]._isChecked = status; const selection = this.getSelection(); - if (status) { - this.$emit('on-select', selection, JSON.parse(JSON.stringify(this.data[_index]))); - } + this.$emit(status ? 'on-select' : 'on-select-cancel', selection, JSON.parse(JSON.stringify(this.data[_index]))); this.$emit('on-selection-change', selection); }, toggleExpand (_index) { -- libgit2 0.21.4