Table tree support @on-row-click
This commit is contained in:
parent
cd68d23fdb
commit
cb6477e080
2 changed files with 20 additions and 5 deletions
|
@ -1,6 +1,14 @@
|
||||||
<template>
|
<template>
|
||||||
<div style="margin: 100px;">
|
<div style="margin: 100px;">
|
||||||
<Table border highlight-row @on-current-change="occ" ref="selection" :columns="columns4" :data="data1" row-key="id">
|
<Table
|
||||||
|
border
|
||||||
|
highlight-row
|
||||||
|
@on-current-change="occ"
|
||||||
|
@on-row-click="orc"
|
||||||
|
ref="selection"
|
||||||
|
:columns="columns4"
|
||||||
|
:data="data1"
|
||||||
|
row-key="id">
|
||||||
<template slot-scope="{ row }" slot="age">
|
<template slot-scope="{ row }" slot="age">
|
||||||
<strong>{{row.age}}</strong>
|
<strong>{{row.age}}</strong>
|
||||||
</template>
|
</template>
|
||||||
|
@ -139,8 +147,12 @@
|
||||||
this.$refs.selection.selectAll(status);
|
this.$refs.selection.selectAll(status);
|
||||||
},
|
},
|
||||||
occ (n, o) {
|
occ (n, o) {
|
||||||
console.log(n);
|
// console.log(n);
|
||||||
console.log(o);
|
// console.log(o);
|
||||||
|
},
|
||||||
|
orc (data, index) {
|
||||||
|
console.log(data);
|
||||||
|
console.log(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -676,8 +676,11 @@
|
||||||
},
|
},
|
||||||
clickCurrentRow (_index, rowKey) {
|
clickCurrentRow (_index, rowKey) {
|
||||||
this.highlightCurrentRow (_index, rowKey);
|
this.highlightCurrentRow (_index, rowKey);
|
||||||
// todo
|
if (rowKey) {
|
||||||
|
this.$emit('on-row-click', JSON.parse(JSON.stringify(this.getCloneDataByRowKey(rowKey))));
|
||||||
|
} else {
|
||||||
this.$emit('on-row-click', JSON.parse(JSON.stringify(this.cloneData[_index])), _index);
|
this.$emit('on-row-click', JSON.parse(JSON.stringify(this.cloneData[_index])), _index);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
dblclickCurrentRow (_index) {
|
dblclickCurrentRow (_index) {
|
||||||
this.highlightCurrentRow (_index);
|
this.highlightCurrentRow (_index);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue