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

时间:2018-07-23 13:56:30   收藏:0   阅读:2846
<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

原文:https://www.cnblogs.com/fujijill/p/9353859.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!