A Vue.js project 支持上一页、下一页、单击页码(包括首页、尾页)和输入页码查询 Support previous page, next page, click page number (including home page, end page) and input page number query
$ npm install vue-pagenavs --save
- Vue.js
^2.5.11
import pagination from 'vue-pagenavs'
Vue.use(pagination);
<template>
<div id="app">
<pagination :params="params" @changePage="changePage"></pagination>
</div>
</template>
页码参数:当前页、每页条数和总共条数(用于计算总页数),默认不可更改每页条数,如果传递pageSizes则显示并可以更改 Parameters: current page, number of pages per page and total number of pages (for calculating total number of pages) 配置参数:是否显示每页条数的选择框、自定义选择框数组 Configuration parameters: whether to display the selection box for each page number and the custom selection box array 传递函数 changePage
data () {
return {
params:{
currentPage:1,
perSize:10,
totalSize:107,
pageSizes : [10, 20, 30, 50, 100, 200]
}
}
},
methods:{
changePage(params){
this.params = params;
}
}
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
ie9+
For detailed explanation on how things work, consult the docs for vue-loader.