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.8k
3 个回答

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

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

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

新手上路,请多包涵

props.$index

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题