【发布时间】:2019-05-21 15:30:22
【问题描述】:
如何在分组表中访问这些标头的索引?
【问题讨论】:
-
请添加一些您的代码,以便我们了解更多
标签: vue.js vue-good-table
如何在分组表中访问这些标头的索引?
【问题讨论】:
标签: vue.js vue-good-table
我才发现,答案就在图片中
{{props.row.vgt_id}}
【讨论】:
您可以使用props.column 获取列名。 props.column 将为您提供完整的列对象,以便您可以从中获取索引。 props.column.field 会给你列名title。
props.column.originalIndex检查索引
props.row访问
props.index访问。original row index 可以通过props.row.originalIndex 访问。 rows[props.row.originalIndex] 访问原始行对象。props.column访问
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>
【讨论】:
props.column 将为您提供完整的列对象,以便您从中获取索引。
props.column.originalIndex查看它
props.row.originalIndex
props.index访问