vue elementUI 默认事件 添加额外参数
有如下需求,在表格中有多个树形,点击树形获取的节点的事件为
<el-table>
<el-table-column>
<template slot-scope="scope">
<el-tree
:ref="'tree'+ scope.$index"
show-checkbox
@check-change="handleCheckChange">
</el-tree>
</template>
</el-table-column>
</el-table>
handleCheckChange(data, checked, indeterminate) {
console.log(data, checked, indeterminate);
},
在触发点击节点默认事件时,我想同时传入当前行数据,修改如下
<el-table>
<el-table-column>
<template slot-scope="scope">
<el-tree
:ref="'tree'+ scope.$index"
show-checkbox
@check-change="(data, checked, indeterminate) => handleCheckChange(data, checked, indeterminate,scope) ">
</el-tree>
</template>
</el-table-column>
</el-table>
handleCheckChange(data, checked, indeterminate,scope) {
console.log(data, checked, indeterminate,scope);
},
这样即可实现默认事件添加额外参数,快来试一试吧 😃