This commit is contained in:
梁灏 2017-09-18 13:52:40 +08:00
parent 75873f9019
commit ade5dbba52
2 changed files with 9 additions and 5 deletions

View file

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<Table highlight-row :columns="columns3" :data="data1" ref="table" @on-current-change="handleChange"></Table> <Table highlight-row :columns="columns3" :data="data1" ref="table" @on-current-change="handleChange" @on-row-click="rc"></Table>
<Button @click="handleClear">clear</Button> <Button @click="handleClear">clear</Button>
</div> </div>
</template> </template>
@ -20,7 +20,8 @@
}, },
{ {
title: '年龄', title: '年龄',
key: 'age' key: 'age',
sortable: true
}, },
{ {
title: '地址', title: '地址',
@ -56,7 +57,10 @@
this.$refs.table.clearCurrentRow(); this.$refs.table.clearCurrentRow();
}, },
handleChange (newData, oldData) { handleChange (newData, oldData) {
console.log(newData, oldData) // console.log(newData, oldData)
},
rc (data, index) {
console.log(data, index);
} }
} }
} }

View file

@ -398,11 +398,11 @@
}, },
clickCurrentRow (_index) { clickCurrentRow (_index) {
this.highlightCurrentRow (_index); this.highlightCurrentRow (_index);
this.$emit('on-row-click', JSON.parse(JSON.stringify(this.cloneData[_index]))); this.$emit('on-row-click', JSON.parse(JSON.stringify(this.cloneData[_index])), _index);
}, },
dblclickCurrentRow (_index) { dblclickCurrentRow (_index) {
this.highlightCurrentRow (_index); this.highlightCurrentRow (_index);
this.$emit('on-row-dblclick', JSON.parse(JSON.stringify(this.cloneData[_index]))); this.$emit('on-row-dblclick', JSON.parse(JSON.stringify(this.cloneData[_index])), _index);
}, },
getSelection () { getSelection () {
let selectionIndexes = []; let selectionIndexes = [];