【问题标题】:How to search Vuetify Data-Table with item's other value如何使用项目的其他值搜索 Vuetify 数据表
【发布时间】:2019-12-27 00:34:44
【问题描述】:

我的 Vuetify 数据表项是这样的 JSON 对象数组

[
  {
    name: 'Frozen Yogurt',
    calories: 237,
    fat: 9.0,   
    price: 30,
    description: 'something other aaa bbb ...'
  },
  {
    name: 'Ice cream sandwich',
    calories: 621,
    fat: 12.5,
    price: 43,
    iron: '1%',
    description: 'someting other ccc ddd ...'
  }
]

数据表只设置了标题[名称,卡路里,脂肪,价格],所以看不到描述或其他值,描述我想在一个expend div中显示,当我输入文本过滤项目时,如何让搜索描述以过滤项目 知道该怎么做吗?

非常感谢,很棒的社区!

【问题讨论】:

    标签: datatable vuejs2 vuetify.js


    【解决方案1】:

    你可以使用:custom-filter 属性。详情here

    :custom-filter="customFilter"
    
    methods: {
      customFilter(value, search, item) {
        return !!search && (item.name.includes(search) || item.description.includes(search))
      }
    }
    

    【讨论】:

      猜你喜欢
      • 2021-11-14
      • 2023-03-13
      • 2018-12-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多