在table中获取点击当前行、列索引
-
先开启table中的
:cell-class-name="tableRowClassName"
,将rowIndex
和columnIndex
放入row
和column
的属性中 -
再table中使用
@cell-dblclick="handleCellClick"
函数
tableRowClassName ({row, column, rowIndex, columnIndex}) {
//把每一行的索引放进row,和index
row.index = rowIndex;
column.index=columnIndex;
},
handleCellClick(row, column, cell, event) {
console.log(row.index)
console.log(column.index)
},