Vuetify,v-data-table标头值用途

时间:2019-06-01 15:31:00

标签: vue.js vuetify.js

value对象数组中的headers属性的v-data-table的用途是什么?

documentation中说

An array of objects that each describe a header column. See the example below for a definition of all properties.

{
  text: string",
  value: string",
  align: 'left' | 'center' | 'right'",
  sortable: boolean",
  class: string[] | string",
  width: string"
}

但是它从来没有真正解释它的目的。

标头对象是否只需要一个唯一键,或者有人可以在HTML中使用value吗?

1 个答案:

答案 0 :(得分:0)

当您将该列定义为sortable: true时,将在分页对象上设置的是值而不是文本。

例如,我的列称为Created at(文本),其值为created_at。这使我可以观察分页对象,并直接通过数据发送订单,而无需执行额外的映射步骤,因为我的API期望orderBy的值可以是created_at或什么都不是。