gpt4 book ai didi

vue.js - Vuetify 数据表搜索不起作用

转载 作者:搜寻专家 更新时间:2023-10-30 22:12:05 27 4
gpt4 key购买 nike

我是 Vue 和 Vuetify 的新手。我在我的项目中使用 vuetify 数据表。除搜索选项外,一切正常。我将所有内容都用作文档。但仍然没有得到任何解决方案。

作为基本要求,我使用这些代码来添加搜索

模板

          <v-text-field
v-model="search"
append-icon="search"
label="Search"
single-line
hide-details
></v-text-field>

<v-data-table
:headers="headers"
:items="sales"
:search="search"
:rows-per-page-items="rowsPerPageItems"

row
wrap
class="elevation-1"
>

脚本

data(){
return{
search: '',
}
}

完整代码如下 https://github.com/Shakilzaman87/pukucrm/blob/master/src/components/sales/Sales.vue

最佳答案

Vuetify 应该在控制台中就此警告您:

[Vuetify] Headers must have a value property that corresponds to a value in the v-model array in "v-data-table"

因此您可以通过添加值来修复搜索选项:

headers: [
{ text: 'Item Name', value: 'item_name' },
{ text: 'Unit Price', value: 'price' },
{ text: 'Quantity', value: 'quantity' },
{ text: 'Customer', value: 'customer' },
{ text: 'Created', value: 'timestamp' },
{ text: 'Total', value: 'total' },
{ text: 'Action', value: 'item_name' }
]

(来自你的 repo 的数据)

关于vue.js - Vuetify 数据表搜索不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51002163/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com