【问题标题】:How can I dynamically populate listColumns in vue-tables-2?如何在 vue-tables-2 中动态填充 listColumns?
【发布时间】:2020-02-04 20:56:48
【问题描述】:

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

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

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"

【问题讨论】:

    标签: javascript vue.js vue-tables-2


    【解决方案1】:

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

    options: {
      filterByColumn: true,
        listColumns: {
            type: this.categories
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2021-12-11
      • 2018-02-11
      • 2018-09-11
      • 2020-03-11
      • 2022-09-30
      • 1970-01-01
      • 2020-03-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多