├── .editorconfig ├── .gitignore ├── README.md ├── bili.config.js ├── example ├── App.vue └── index.js ├── package.json ├── src ├── Laypage.vue └── index.js └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | [*] 3 | indent_style = space 4 | indent_size = 2 5 | end_of_line = lf 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | [*.md] 10 | trim_trailing_whitespace = false 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.json 3 | example/dist 4 | dist -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## vue-laypage 2 | 3 | > A simple pagination component for Vue.js, Based on [layPage](http://laypage.layui.com/) 4 | 5 | [![NPM version](https://img.shields.io/npm/v/vue-laypage.svg?style=flat)](https://npmjs.com/package/vue-laypage) 6 | [![Vue 2.x](https://img.shields.io/badge/Vue-2.x-brightgreen.svg)](https://vuejs.org/v2/guide/) 7 | [![NPM downloads](https://img.shields.io/npm/dm/vue-laypage.svg?style=flat)](https://npmjs.com/package/vue-laypage) 8 | 9 | ## Installation and Use 10 | 11 | ``` 12 | $ npm install vue-laypage --save 13 | ``` 14 | 15 | ``` 16 | import Laypage from 'vue-laypage' 17 | import 'vue-laypage/vue-laypage.css' 18 | 19 | export default { 20 | components: { 21 | Laypage 22 | } 23 | } 24 | ``` 25 | 26 | or 27 | 28 | ``` 29 | import Vue from 'vue' 30 | import Laypage from 'vue-laypage' 31 | import 'vue-laypage/vue-laypage.css' 32 | 33 | Vue.use(Laypage) 34 | ``` 35 | ## Props 36 | | Name | Type | Description | 37 | | --- | --- | --- | 38 | | pages | Number | 总页数,必填 | 39 | | groups | Number | 一组显示几页,默认为5 | 40 | | prev | String, Number, Boolean | 上一页按钮的文字,false 不显示 | 41 | | next | String, Number, Boolean | 下一页按钮的文字,false 不显示 | 42 | | first | String, Number, Boolean | 首页按钮的文字,false 不显示 | 43 | | last | String, Number, Boolean | 尾页按钮的文字,false 不显示 | 44 | | skin | String | 按钮高亮的颜色,默认#42b983 | 45 | | skip | Boolean | 是否显示跳转 | 46 | | jump | Function | 触发分页后的回调,返回当前页 | 47 | 48 | ## LICENSE 49 | 50 | MIT 51 | -------------------------------------------------------------------------------- /bili.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | format: ['umd', 'umd-min', 'cjs', 'es'], 3 | banner: true, 4 | plugins: ['vue'] 5 | }; -------------------------------------------------------------------------------- /example/App.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 39 | 40 | 45 | -------------------------------------------------------------------------------- /example/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import Laypage from '../src' 4 | 5 | Vue.use(Laypage) 6 | 7 | new Vue({ 8 | el: '#app', 9 | render: h => h(App) 10 | }) 11 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-laypage", 3 | "description": "A simple pagination component for Vue.js", 4 | "version": "1.0.4", 5 | "main": "dist/vue-laypage.cjs.js", 6 | "module": "dist/vue-laypage.es.js", 7 | "files": ["dist"], 8 | "scripts": { 9 | "test": "echo lol", 10 | "build": "bili", 11 | "example": "poi example/index.js", 12 | "build:example": "poi build example/index.js --out-dir example/dist" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "git+https://github.com/sinchang/vue-laypage.git" 17 | }, 18 | "bugs": { 19 | "url": "https://github.com/sinchang/vue-laypage/issues" 20 | }, 21 | "keywords": ["vue", "pagination", "laypage"], 22 | "author": "sinchang ", 23 | "devDependencies": { 24 | "bili": "^3.1.1", 25 | "poi": "^10.1.6", 26 | "rollup-plugin-vue": "^4.1.0" 27 | }, 28 | "license": "MIT" 29 | } 30 | -------------------------------------------------------------------------------- /src/Laypage.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 112 | 113 | 158 | 159 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import Laypage from './Laypage.vue' 2 | 3 | Laypage.install = Vue => { 4 | Vue.component(Laypage.name, Laypage) 5 | } 6 | 7 | if (typeof window !== 'undefined' && window.Vue) { 8 | window.Vue.use(Laypage) 9 | } 10 | 11 | export default Laypage 12 | --------------------------------------------------------------------------------