我想为表中的每一列添加单独的列搜索(文本输入)。我在vuetify中找到了它,但没有相关的示例。我正在使用下面的代码。
我需要一个像这样的表:this datatable
我在main组件中传递这个参数
组件
<v-data-table
:headers="complex.headers"
:search="search"
:custom-filter="search"
:items="items"
:rows-per-page-items = "[1,2]"
class="elevation-1"
item-key="name"
v-model="complex.selected"
:loading="this.items && this.items.length ? false : true"
:pagination.sync="pagination"
:total-items="totalData"
></v-data-table>发布于 2018-12-21 21:41:49
使用表头槽。下面是一个如何实现表格标题下的输入文本框的示例。这将在表头中创建两行-第一行将包含标题,第二行将包含输入框,其中表头列的filterable设置为true。如果你想为每一列创建输入框,你可以省略v-show指令。非常简单的例子,不会为字段产生下拉列表等,但应该给你一个基本的想法。
<template
slot="headers"
slot-scope="props"
>
<tr>
<th
v-for="header in props.headers"
:key="header.text"
align="left"
:class="['column sortable', pagination.descending ? 'desc' : 'asc', header.value === pagination.sortBy ? 'active' : '']"
@click="changeSort(header.value)"
>
<VIcon small>
arrow_upward
</VIcon>
{{ header.text }}
</th>
</tr>
<tr>
<th
v-for="header in props.headers"
v-show="header.filterable === 'true'"
:key="header.text"
>
<VTextField
:label="header.text"
box
/>
</th>
</tr>
</template>https://stackoverflow.com/questions/53535457
复制相似问题