vue.js - 验证 : Show pagination controls at the top of my v-data-table as well as in the footer

标签 vue.js vuejs2 vue-component vuetify.js v-data-table

v-data-table有一个 top插槽,带有 pagination prop 的结构与 footer 的结构匹配投币口。是否可以分配 top插槽引用相同的(大概是 v-pagination )控制 footer正在使用?

我的目标是复制表格顶部的分页控件(位于页脚中)。

最佳答案

事实上,v-data-table 中默认显示的控件页脚插槽正常(公共(public) - 非内部)Vuetify 组件 v-data-footer .您可以像这样轻松地将其添加到顶部插槽中:

<div id="app">
  <v-app id="inspire">
    <v-data-table
      v-model="selected"
      :headers="headers"
      :items="desserts"
      :items-per-page="5"
      :single-select="true"
      item-key="name"
      show-select
      class="elevation-1"
    >
      <template v-slot:top="{ pagination, options, updateOptions }">
        <v-data-footer 
          :pagination="pagination" 
          :options="options"
          @update:options="updateOptions"
          items-per-page-text="$vuetify.dataTable.itemsPerPageText"/>
      </template>
    </v-data-table>
  </v-app>
</div>

Demo

关于vue.js - 验证 : Show pagination controls at the top of my v-data-table as well as in the footer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59759939/

相关文章:

javascript - 拉维尔 : How to hide the interpolation code before Vue js loads?

javascript - 如何使用 VueJs 从 json 数据呈现列表元素

jquery - 如何使用 vue.js 2 更改跨度上的文本?

javascript - 如何检测是否为 div 启用了显示更多?

vue.js - Vue js 子组件中未定义的 Prop 。但仅在其脚本中

javascript - Vuex:getter 应该是函数,但模块 "getters.default"中的 "customer"是 {}

vue.js - 如何转义vuejs中的内容?

forms - 使用 Vue js 发布具有多个组件的表单的最佳方法是什么

javascript - Vue2理解:class attribute

javascript - 使用此访问 Vue 实例