1. 程式人生 > >查找element-ui中el-table組件的行數

查找element-ui中el-table組件的行數

pre role 情況下 一行 名稱 查找 序號 cli current

<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

查找element-ui中el-table組件的行數