0

您如何在分组表中访问这些标题的索引?

table_screenshot

4

2 回答 2

1

我才发现,答案就在图片中

{{props.row.vgt_id}}

于 2018-12-21T06:32:04.500 回答
0

您可以使用props.column. props.column将为您提供完整的列对象,以便您可以从中获取索引。props.column.field会给你列名title

  1. 您可以检查索引props.column.originalIndex
  2. 可以通过访问原始行对象props.row
  3. 当前显示的表格行索引可以通过 访问props.index
  4. original row index可以通过访问props.row.originalIndex
  5. 然后,您可以使用 访问原始行对象rows[props.row.originalIndex]
  6. 可以通过以下方式访问列对象props.column
  7. 您可以通过以下方式访问格式化的行数据(例如 - 格式化的日期)props.formattedRow

例如 :

<vue-good-table
  :columns="columns"
  :rows="rows">
  <template slot="table-row" slot-scope="props">
    <span v-if="props.column.field == 'age'">
      <span style="font-weight: bold; color: blue;">{{props.row.age}}</span> 
    </span>
    <span v-else>
      {{props.formattedRow[props.column.field]}}
    </span>
  </template>
</vue-good-table>

来源

于 2018-12-21T06:26:12.547 回答