鍍金池/ 問(wèn)答/HTML/ element ui table如何在行內(nèi)獲取index

element ui table如何在行內(nèi)獲取index

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

現(xiàn)在需要獲取當(dāng)前行的index來(lái)判斷當(dāng)前行是否顯示,但是網(wǎng)上找了一圈都沒(méi)找到合適的方法

回答
編輯回答
墨染殤

el-table-column是列,如果要根據(jù)行來(lái)顯示數(shù)據(jù),在computed里面直接過(guò)濾數(shù)組。

computed: {
  tableData() {
    return this.financiadata.filter(row => row.one2 === true)
  }
}
2018年6月15日 13:58
編輯回答
莓森

寫(xiě)成這樣試試:v-if="financiadata[scope.$index].one2 === true"

2018年1月28日 08:55