element ui table如何在行内获取index

                    <el-table :data="financiadata" style="width: 100%">
                      <el-table-column slot-scope="props" v-if="financiadata[index].one2 === true">
                    </el-table>

现在需要获取当前行的index来判断当前行是否显示,但是网上找了一圈都没找到合适的方法

阅读 20.9k
3 个回答

el-table-column是列,如果要根据行来显示数据,在computed里面直接过滤数组。

computed: {
  tableData() {
    return this.financiadata.filter(row => row.one2 === true)
  }
}

写成这样试试:v-if="financiadata[scope.$index].one2 === true"

新手上路,请多包涵

props.$index

推荐问题