Vuetify 删除 v-data-table 上的分页

gol*_*ree 15 pagination vue.js vuetify.js

我想删除 v-data-table 上的分页,使用 hide-default-footer 但它不起作用。

尝试使用 hide-dafault-footer

<v-data-table
        :headers="headers"
        :items="desserts"
        hide-default-header
        hide-default-footer
        class="elevation-1"
      >
        <template slot="items" slot-scope="props">
          <td>{{ props.index }}</td>
          <td>{{ props.item.name }}</td>
          <td>{{ getProject(props.item.project_uuid) }}</td>
          <td>{{ props.item.deadline }}</td>
          <td>{{ getUser(props.item.executor) }}</td>
          <td>{{ getUser(props.item.creator) }}</td>
          <td>{{ props.item.description }}</td>
        </template>
      </v-data-table>
Run Code Online (Sandbox Code Playgroud)

想去掉分页

itt*_*tus 25

它应该是 :hide-default-footer="true"

<v-data-table
        :headers="headers"
        :items="desserts"
        :hide-default-header="true"
        :hide-default-footer="true"
        class="elevation-1"
      >
        <template slot="items" slot-scope="props">
          <td>{{ props.index }}</td>
          <td>{{ props.item.name }}</td>
          <td>{{ getProject(props.item.project_uuid) }}</td>
          <td>{{ props.item.deadline }}</td>
          <td>{{ getUser(props.item.executor) }}</td>
          <td>{{ getUser(props.item.creator) }}</td>
          <td>{{ props.item.description }}</td>
        </template>
      </v-data-table>
Run Code Online (Sandbox Code Playgroud)

codepen 上的演示

  • 请参阅 idirsun 评论,如果您只这样做,您将只能看到前 10 个元素。 (2认同)

小智 14

添加 :hide-default-header="true" :hide-default-footer="true" 只会删除默认的页脚和页眉,要完全禁用您需要添加disable-pagination到您的分页 <v-data-table>


Win*_*ter 13

我只是将这两个道具添加到v-data-table

<v-data-table hide-default-footer disable-pagination />
Run Code Online (Sandbox Code Playgroud)

无需分配true给 props .iehide-default-footer="true"

我通常就是这么做的。


小智 12

For those arriving here using Vuetify 3, I've found adding an empty footer slot achieves the same:

<template #bottom></template>
Run Code Online (Sandbox Code Playgroud)

To show more than the first 10 items, disable pagination with :items-per-page="0". Full example:

<v-data-table
    :items="thedata"
    :items-per-page="0"
  >
  <template #bottom></template>
</v-data-table>
Run Code Online (Sandbox Code Playgroud)

Here's further documentation on the footer slot:


小智 6

要禁用 v-data-table 上的分页,请使用disable-pagination prop在此输入图像描述

  • 不知道为什么,但这个道具没有效果。 (5认同)

小智 6

正确的答案是添加disable-paginationVuetify 文档中所述的属性: https: //vuetifyjs.com/en/components/data-tables/Vuetify 文档

这适用于 Vuetify 2.x 版本,如果您使用 Vuetify 1.5,请改用该hide-actions属性。 https://v15.vuetifyjs.com/en/components/data-tables

  • 这将关闭分页,并且将显示整个项目列表。但这并不会隐藏分页页脚 (2认同)