1

假设我有一组通过道具可用的类别名称。

vue-tables-2中,如何category在选项中动态填充过滤器listColumns

listColumns: {
  type: [{
    id: 1,
    text: 'User'
  },
  {
    id: 2,
    text: 'Admin'
  }],
  category: function () {
    this.categories.map((cat, index) => { return { id: index, text: cat } })
  }
}

这样做会返回以下错误:

[Vue warn]: Error in render: "TypeError: _this.opts.listColumns[column].filter is not a function"
4

1 回答 1

1

您可以在选项中插入道具。

options: {
  filterByColumn: true,
    listColumns: {
        type: this.categories
    }
}
于 2019-10-07T15:52:50.860 回答