查找element-ui中el-table组件的行数

<el-table :data="roleData" border stripe
                      highlight-current-row  :height="autoHeightRow" :row-class-name="rowClassName"  @row-click='handleRowClickRole' ref="RoleTable">
              <el-table-column type="index" label="序号" width="55"> </el-table-column>
              <el-table-column prop="RuleName" label="规则名称" width="180"> </el-table-column>
</el-table>
rowClassName({row, rowIndex}) {
        //把每一行的索引放进row
        row.index = rowIndex;
     console.log(row) },

一般情况下'row-click'方法只能获取该行数据,为了能获取到该行的行数index,用row-class-name给每一行都加上index,即可获取index

猜你喜欢

转载自www.cnblogs.com/fujijill/p/9353859.html