如何实现点击表格的当前行实现某些操作?也就是表格当前行的时间。例如我们使用element-UI中table表格。可以使用row-click绑定事件获取表格element-UI中table表格的当前行的数据的id。
element UI 的row-click事件如何使用参数?
点击行就会触发handdle事件,row, event, column参数不需要写在html中,再方法里直接使用就可以了。
例如:
<el-table
:data="buildingRankList"
@row-click="openDetails"
>
<el-table-column type="selection" width="40"></el-table-column>
<el-table-column type="index" width="50"></el-table-column>
<el-table-column property="name" label="设备名称"></el-table-column>
</el-table>
JavaScript部分:
openDetails(row, event, column) {
console.log(row+","+event+","+column);
}
推荐阅读: