Merge pull request #1314 from rijn/705

Add an event @on-select-cancel to Table
This commit is contained in:
Aresn 2017-07-10 09:25:18 +08:00 committed by GitHub
commit ae835d650b
2 changed files with 13 additions and 4 deletions

View file

@ -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';
@ -8,6 +8,11 @@
data () {
return {
columns5: [
{
type: 'selection',
width: 60,
align: 'center'
},
{
type: 'expand',
render: (h) => {
@ -73,6 +78,12 @@
},
]
}
},
methods: {
onSelect (value) {
window.alert(value);
}
}
}
</script>

View file

@ -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) {