vue 滑动分页_滑动分页Vue组件

一个介绍Vue滑动分页组件的文章,详细说明了安装(包括Node和浏览器环境)、基本用法,强调组件不处理页面变化,需要自定义处理程序来实现页面切换逻辑。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

vue 滑动分页

Vue的滑动分页 (Sliding Pagination for Vue)

ARIA-friendly pagination component with a sliding window.

带有滑动窗口的ARIA友好分页组件。

安装 (Installation)

节点 (Node)

npm install vue-sliding-pagination --save

npm install vue-sliding-pagination --save

or, for the fäncÿ people,

或者,对于法恩族人,

yarn add vue-sliding-pagination

yarn add vue-sliding-pagination

浏览器 (Browser)

Currently, no browser build is available.

当前,没有可用的浏览器版本。

用法 (Usage)

Basic usage of the pagination component only requires the current page, the total number of pages and a handler which is called on page change.

分页组件的基本用法仅需要当前页面,页面总数和在页面更改时调用的处理程序。

The pagination component does not handle page changes by itself, instead you are required to provide a page change handler which should contain all your page changing logic (e.g. a vuex store dispatch) and eventually change the current page to the passed one. In later releases, a v-model approach to currentPage may be offered, but was opted against for the time being.

分页组件不能单独处理页面更改 ,而是需要提供一个页面更改处理程序,该处理程序应包含所有页面更改逻辑(例如,vuex存储分派),并最终将当前页面更改为传递的页面。 在以后的版本中,可能会提供对currentPage的v模型方法,但暂时不采用。

Thus, to get a paginator with default settings (please consult the options listing below for details), the following markup and script sections provide a starting point:

因此,要使分页器具有默认设置(请参考下面的选项以获得详细信息),以下标记和脚本部分提供了一个起点:

<sliding-pagination
  :current="currentPage"
  :total="totalPages"
  @page-change="pageChangeHandler"
></sliding-pagination>
import SlidingPagination from 'vue-sliding-pagination'

// in component or vue instance
components: {
  // ...
  SlidingPagination
},
data() {
  return {
    // ...
    currentPage: 1,
    totalPages: 10
  }
},
methods: {
  // ...
  pageChangeHandler(selectedPage) {
    this.currentPage = selectedPage
  }
}

翻译自: https://vuejsexamples.com/a-sliding-pagination-vue-component/

vue 滑动分页

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值