v-page 2.0.6 → 2.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +93 -90
- package/dist/v-page.js +1 -1
- package/dist/v-page.js.map +1 -1
- package/package.json +39 -14
- package/types/index.d.ts +62 -0
- package/.babelrc +0 -6
- package/.editorconfig +0 -9
- package/src/Page.vue +0 -185
- package/src/index.js +0 -21
- package/src/language.js +0 -28
- package/src/page.scss +0 -125
- package/webpack.config.js +0 -113
package/README.md
CHANGED
|
@@ -1,90 +1,93 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
1
|
+
# [v-page](https://terryz.github.io/vue/#/page) · [](https://circleci.com/gh/TerryZ/v-page) [](https://codecov.io/gh/TerryZ/v-page) [](https://www.npmjs.com/package/v-page) [](https://mit-license.org/) [](https://www.npmjs.com/package/v-page) [](https://standardjs.com)
|
|
2
|
+
|
|
3
|
+
A simple pagination bar, including size Menu, i18n support, based on **Vue2**
|
|
4
|
+
|
|
5
|
+
<img src="https://terryz.github.io/image/v-page/v-page.png" alt="v-page" height="54px">
|
|
6
|
+
|
|
7
|
+
## Examples and Documentation
|
|
8
|
+
|
|
9
|
+
Live Examples on [CodePen](https://codepen.io/terry05/pen/yjZYLR), more exmaples and documentation please visit below sites
|
|
10
|
+
|
|
11
|
+
- [English site](https://terryz.github.io/vue/#/page)
|
|
12
|
+
- [国内站点](https://terryz.gitee.io/vue/#/page)
|
|
13
|
+
|
|
14
|
+
The jQuery version: [bPage](https://github.com/TerryZ/bPage)
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
<a href="https://nodei.co/npm/v-page/"><img src="https://nodei.co/npm/v-page.png"></a>
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npm i -S v-page
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Include and install plugin in your `main.js` file.
|
|
25
|
+
|
|
26
|
+
```js
|
|
27
|
+
// add component in global scope as plugin
|
|
28
|
+
import Vue from 'vue'
|
|
29
|
+
import Page from 'v-page'
|
|
30
|
+
Vue.use(Page, {
|
|
31
|
+
global config options
|
|
32
|
+
})
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
You also can use `v-page` in local component
|
|
36
|
+
|
|
37
|
+
```vue
|
|
38
|
+
<template>
|
|
39
|
+
<v-page></v-page>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script>
|
|
43
|
+
import { Page } from 'v-page'
|
|
44
|
+
export default {
|
|
45
|
+
components: {
|
|
46
|
+
'v-page': Page
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
</script>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Usage
|
|
53
|
+
|
|
54
|
+
```vue
|
|
55
|
+
<template>
|
|
56
|
+
<v-page
|
|
57
|
+
:total-row="totalRow"
|
|
58
|
+
@page-change="pageChange"
|
|
59
|
+
></v-page>
|
|
60
|
+
</template>
|
|
61
|
+
|
|
62
|
+
<script>
|
|
63
|
+
export default {
|
|
64
|
+
data () {
|
|
65
|
+
return {
|
|
66
|
+
totalRow: 100 // required option
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
methods: {
|
|
70
|
+
// receive page info change callback
|
|
71
|
+
pageChange (pInfo) {
|
|
72
|
+
console.log(pInfo) // { pageNumber: 1, pageSize: 10 }
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
</script>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Vue plugin series
|
|
80
|
+
|
|
81
|
+
| Plugin | Status | Description |
|
|
82
|
+
| :---------------- | :-- | :-- |
|
|
83
|
+
| [v-page](https://github.com/TerryZ/v-page) | [](https://www.npmjs.com/package/v-page) | A simple pagination bar, including length Menu, i18n support |
|
|
84
|
+
| [v-dialogs](https://github.com/TerryZ/v-dialogs) | [](https://www.npmjs.com/package/v-dialogs) | A simple and powerful dialog, including Modal, Alert, Mask and Toast modes |
|
|
85
|
+
| [v-tablegrid](https://github.com/TerryZ/v-tablegrid) | [](https://www.npmjs.com/package/v-tablegrid) | A simpler to use and practical datatable |
|
|
86
|
+
| [v-uploader](https://github.com/TerryZ/v-uploader) | [](https://www.npmjs.com/package/v-uploader) | A Vue2 plugin to make files upload simple and easier, <br>you can drag files or select file in dialog to upload |
|
|
87
|
+
| [v-ztree](https://github.com/TerryZ/v-ztree) | [](https://www.npmjs.com/package/v-ztree) | A simple tree for Vue2, support single or multiple(check) select tree, <br>and support server side data |
|
|
88
|
+
| [v-gallery](https://github.com/TerryZ/v-gallery) | [](https://www.npmjs.com/package/v-gallery) | A Vue2 plugin make browsing images in gallery |
|
|
89
|
+
| [v-region](https://github.com/TerryZ/v-region) | [](https://www.npmjs.com/package/v-region) | A simple region selector, provide Chinese administrative division data |
|
|
90
|
+
| [v-selectpage](https://github.com/TerryZ/v-selectpage) | [](https://www.npmjs.com/package/v-selectpage) | A powerful selector for Vue2, list or table view of pagination, <br>use tags for multiple selection, i18n and server side resources supports |
|
|
91
|
+
| [v-suggest](https://github.com/TerryZ/v-suggest) | [](https://www.npmjs.com/package/v-suggest) | A Vue2 plugin for input suggestions by autocomplete |
|
|
92
|
+
| [v-playback](https://github.com/TerryZ/v-playback) | [](https://www.npmjs.com/package/v-playback) | A Vue2 plugin to make video play easier |
|
|
93
|
+
| [v-selectmenu](https://github.com/TerryZ/v-selectmenu) | [](https://www.npmjs.com/package/v-selectmenu) | A simple, easier and highly customized menu solution |
|
package/dist/v-page.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("vPage",[],t):"object"==typeof exports?exports.vPage=t():e.vPage=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(n){if(a[n])return a[n].exports;var i=a[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var a={};return t.m=e,t.c=a,t.d=function(e,a,n){t.o(e,a)||Object.defineProperty(e,a,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var a=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(a,"a",a),a},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=1)}([function(e,t,a){"use strict";var n=a(4),i=a(5);a.n(i);t.a={name:"v-page",props:{totalRow:{type:Number,default:0},pageSizeMenu:{type:[Boolean,Array],default:function(){return[10,20,50,100]}},language:{type:String,default:"cn"},align:{type:String,default:"right"},disabled:{type:Boolean,default:!1},border:{type:Boolean,default:!0},info:{type:Boolean,default:!0},pageNumber:{type:Boolean,default:!0},first:{type:Boolean,default:!0},last:{type:Boolean,default:!0}},data:function(){return{pageSize:!1===this.pageSizeMenu?10:this.pageSizeMenu[0],totalPage:0,currentPage:0,pageNumberSize:5,i18n:n.a[this.language]||n.a.cn}},computed:{pageNumbers:function(){var e=1,t=void 0,a=[],n=Math.floor(this.pageNumberSize/2);this.totalPage<this.pageNumberSize?t=this.totalPage:this.currentPage<=n?t=this.pageNumberSize:this.currentPage>=this.totalPage-n?(e=this.totalPage-this.pageNumberSize+1,t=this.totalPage):(e=this.currentPage-n,t=e+this.pageNumberSize-1);for(var i=e;i<=t;i++)a.push(i);return a},pageInfo:function(){return this.i18n.pageInfo.replace("#pageNumber#",this.currentPage).replace("#totalPage#",this.totalPage).replace("#totalRow#",this.totalRow)},classes:function(){return{"v-pagination--no-border":!this.border,"v-pagination--right":"right"===this.align,"v-pagination--center":"center"===this.align}}},watch:{totalRow:function(){this.calcTotalPage()}},methods:{goPage:function(e){if("number"==typeof e){var t=1;e>t&&(t=e),e>this.totalPage&&this.totalPage>0&&(t=this.totalPage),t!==this.currentPage&&(this.currentPage=t,this.change(),this.calcTotalPage())}},reload:function(){this.change()},change:function(){this.$emit("page-change",{pageNumber:this.currentPage,pageSize:Number(this.pageSize)})},calcTotalPage:function(){this.totalPage=Math.ceil(this.totalRow/this.pageSize)},position:function(e){if("string"==typeof e)switch(e){case"first":return 1;case"previous":return this.currentPage-1;case"next":return this.currentPage+1;case"last":return this.totalPage}else if("number"==typeof e)return e},switchPage:function(e){this.disabled||this.goPage(this.position(e))},switchLength:function(){this.goPage(1)}},mounted:function(){this.goPage(1)}}},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=a(2);a.d(t,"vPage",function(){return n.a});var i={install:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Object.keys(t).length&&(t.language&&(n.a.props.language.default=t.language),t.align&&(n.a.props.align.default=t.align),"boolean"==typeof t.info&&(n.a.props.info.default=t.info),"boolean"==typeof t.border&&(n.a.props.border.default=t.border),"boolean"==typeof t.pageNumber&&(n.a.props.pageNumber.default=t.pageNumber),"boolean"==typeof t.first&&(n.a.props.first.default=t.first),"boolean"==typeof t.last&&(n.a.props.last.default=t.last),void 0!==t.pageSizeMenu&&(n.a.props.pageSizeMenu.default=t.pageSizeMenu)),e.component(n.a.name,n.a)}};t.default=i},function(e,t,a){"use strict";var n=a(0),i=a(10),o=a(3),r=o(n.a,i.a,!1,null,null,null);t.a=r.exports},function(e,t){e.exports=function(e,t,a,n,i,o){var r,s=e=e||{},l=typeof e.default;"object"!==l&&"function"!==l||(r=e,s=e.default);var u="function"==typeof s?s.options:s;t&&(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0),a&&(u.functional=!0),i&&(u._scopeId=i);var p;if(o?(p=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),n&&n.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(o)},u._ssrRegister=p):n&&(p=n),p){var d=u.functional,c=d?u.render:u.beforeCreate;d?(u._injectStyles=p,u.render=function(e,t){return p.call(t),c(e,t)}):u.beforeCreate=c?[].concat(c,p):[p]}return{esModule:r,exports:s,options:u}}},function(e,t,a){"use strict";var n={cn:{pageLength:"每页记录数 ",pageInfo:"当前显示第 #pageNumber# / #totalPage# 页(共#totalRow#条记录)",first:"首页",previous:"«",next:"»",last:"尾页"},en:{pageLength:"Page length ",pageInfo:"Current #pageNumber# / #totalPage# (total #totalRow# records)",first:"First",previous:"«",next:"»",last:"Last"},jp:{pageLength:"ページごとの記録数",pageInfo:"現在の第 #pageNumber# / #totalPage# ページ(全部で #totalRow# 条の記録)",first:"トップページ",previous:"«",next:"»",last:"尾のページ"}};t.a=n},function(e,t,a){var n=a(6);"string"==typeof n&&(n=[[e.i,n,""]]),n.locals&&(e.exports=n.locals);a(8)("2dbe92cf",n,!0,{})},function(e,t,a){t=e.exports=a(7)(!1),t.push([e.i,"div.v-pagination{margin:0;display:block}div.v-pagination.v-pagination--right{text-align:right}div.v-pagination.v-pagination--center{text-align:center}div.v-pagination>ul{display:inline-block;list-style:none;margin:0;padding:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:0 1px 2px rgba(0,0,0,.05);box-shadow:0 1px 2px rgba(0,0,0,.05)}div.v-pagination>ul>li{text-align:center;margin:0;display:inline}div.v-pagination>ul>li>a{margin:0 0 0 -1px;position:relative;border:1px solid #dee2e6;padding:6px 12px;line-height:1.4;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;background-color:#fff;font-size:14px;display:inline-block;float:left;text-decoration:none;color:#333;-webkit-transition:all .5s cubic-bezier(.175,.885,.32,1);transition:all .5s cubic-bezier(.175,.885,.32,1)}div.v-pagination>ul>li>a:hover{z-index:2;-webkit-box-shadow:0 0 8px rgba(0,0,0,.2);-moz-box-shadow:0 0 8px rgba(0,0,0,.2);box-shadow:0 0 8px rgba(0,0,0,.2)}div.v-pagination>ul>li.disabled>a,div.v-pagination>ul>li.v-pagination__info>a,div.v-pagination>ul>li.v-pagination__list>a{color:#999;cursor:default}div.v-pagination>ul>li.disabled>a:hover,div.v-pagination>ul>li.v-pagination__info>a:hover,div.v-pagination>ul>li.v-pagination__list>a:hover{color:#999;background-color:#fff;box-shadow:none}div.v-pagination>ul>li.active>a,div.v-pagination>ul>li.active>span{cursor:default;color:#999;background-color:#eee}div.v-pagination>ul>li.active>a:hover,div.v-pagination>ul>li.active>span:hover{box-shadow:none}div.v-pagination>ul>li:first-child>a,div.v-pagination>ul>li:first-child>span{border-left-width:1px;border-bottom-left-radius:2px;border-top-left-radius:2px;-webkit-border-bottom-left-radius:2px;-webkit-border-top-left-radius:2px;-moz-border-radius-bottomleft:2px;-moz-border-radius-topleft:2px}div.v-pagination>ul>li:last-child>a,div.v-pagination>ul>li:last-child>span{border-top-right-radius:2px;border-bottom-right-radius:2px;-webkit-border-bottom-right-radius:2px;-webkit-border-top-right-radius:2px;-moz-border-radius-bottomright:2px;-moz-border-radius-topright:2px}div.v-pagination>ul>li.v-pagination__list select{margin-left:5px;width:auto!important;font-size:12px;padding:0;display:inline-block;border:1px solid #ccc;color:#333;outline:0}div.v-pagination>ul>li.v-pagination__list select:hover{-webkit-box-shadow:0 0 3px rgba(0,0,0,.2);-moz-box-shadow:0 0 3px rgba(0,0,0,.2);box-shadow:0 0 3px rgba(0,0,0,.2)}div.v-pagination>ul>li.v-pagination__list select[disabled]{color:#999}div.v-pagination.v-pagination--no-border>ul{box-shadow:none}div.v-pagination.v-pagination--no-border>ul>li:not(.active):not(.disabled):not(.v-pagination__info):not(.v-pagination__list) a:hover{box-shadow:none;z-index:auto;background-color:#ddd}div.v-pagination.v-pagination--no-border>ul>li.active a{background-color:#f5f5f5;color:#aaa}div.v-pagination.v-pagination--no-border>ul>li>a{border:0}div.v-pagination.v-pagination--no-border>ul>li>a:hover{z-index:auto}",""])},function(e,t){function a(e,t){var a=e[1]||"",i=e[3];if(!i)return a;if(t&&"function"==typeof btoa){var o=n(i);return[a].concat(i.sources.map(function(e){return"/*# sourceURL="+i.sourceRoot+e+" */"})).concat([o]).join("\n")}return[a].join("\n")}function n(e){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e))))+" */"}e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n=a(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n}).join("")},t.i=function(e,a){"string"==typeof e&&(e=[[null,e,""]]);for(var n={},i=0;i<this.length;i++){var o=this[i][0];"number"==typeof o&&(n[o]=!0)}for(i=0;i<e.length;i++){var r=e[i];"number"==typeof r[0]&&n[r[0]]||(a&&!r[2]?r[2]=a:a&&(r[2]="("+r[2]+") and ("+a+")"),t.push(r))}},t}},function(e,t,a){function n(e){for(var t=0;t<e.length;t++){var a=e[t],n=p[a.id];if(n){n.refs++;for(var i=0;i<n.parts.length;i++)n.parts[i](a.parts[i]);for(;i<a.parts.length;i++)n.parts.push(o(a.parts[i]));n.parts.length>a.parts.length&&(n.parts.length=a.parts.length)}else{for(var r=[],i=0;i<a.parts.length;i++)r.push(o(a.parts[i]));p[a.id]={id:a.id,refs:1,parts:r}}}}function i(){var e=document.createElement("style");return e.type="text/css",d.appendChild(e),e}function o(e){var t,a,n=document.querySelector("style["+b+'~="'+e.id+'"]');if(n){if(f)return v;n.parentNode.removeChild(n)}if(m){var o=g++;n=c||(c=i()),t=r.bind(null,n,o,!1),a=r.bind(null,n,o,!0)}else n=i(),t=s.bind(null,n),a=function(){n.parentNode.removeChild(n)};return t(e),function(n){if(n){if(n.css===e.css&&n.media===e.media&&n.sourceMap===e.sourceMap)return;t(e=n)}else a()}}function r(e,t,a,n){var i=a?"":n.css;if(e.styleSheet)e.styleSheet.cssText=x(t,i);else{var o=document.createTextNode(i),r=e.childNodes;r[t]&&e.removeChild(r[t]),r.length?e.insertBefore(o,r[t]):e.appendChild(o)}}function s(e,t){var a=t.css,n=t.media,i=t.sourceMap;if(n&&e.setAttribute("media",n),h.ssrId&&e.setAttribute(b,t.id),i&&(a+="\n/*# sourceURL="+i.sources[0]+" */",a+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */"),e.styleSheet)e.styleSheet.cssText=a;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(a))}}var l="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!l)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var u=a(9),p={},d=l&&(document.head||document.getElementsByTagName("head")[0]),c=null,g=0,f=!1,v=function(){},h=null,b="data-vue-ssr-id",m="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());e.exports=function(e,t,a,i){f=a,h=i||{};var o=u(e,t);return n(o),function(t){for(var a=[],i=0;i<o.length;i++){var r=o[i],s=p[r.id];s.refs--,a.push(s)}t?(o=u(e,t),n(o)):o=[];for(var i=0;i<a.length;i++){var s=a[i];if(0===s.refs){for(var l=0;l<s.parts.length;l++)s.parts[l]();delete p[s.id]}}}};var x=function(){var e=[];return function(t,a){return e[t]=a,e.filter(Boolean).join("\n")}}()},function(e,t){e.exports=function(e,t){for(var a=[],n={},i=0;i<t.length;i++){var o=t[i],r=o[0],s=o[1],l=o[2],u=o[3],p={id:e+":"+i,css:s,media:l,sourceMap:u};n[r]?n[r].parts.push(p):a.push(n[r]={id:r,parts:[p]})}return a}},function(e,t,a){"use strict";var n=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"v-pagination",class:e.classes},[a("ul",[e.pageSizeMenu?a("li",{staticClass:"v-pagination__list"},[a("a",[e._v(e._s(e.i18n.pageLength)+"\n "),a("select",{directives:[{name:"model",rawName:"v-model",value:e.pageSize,expression:"pageSize"}],attrs:{disabled:e.disabled},on:{change:[function(t){var a=Array.prototype.filter.call(t.target.options,function(e){return e.selected}).map(function(e){return"_value"in e?e._value:e.value});e.pageSize=t.target.multiple?a:a[0]},e.switchLength]}},e._l(e.pageSizeMenu,function(t,n){return a("option",{key:n},[e._v(e._s(t))])}),0)])]):e._e(),e._v(" "),e.info?a("li",{staticClass:"v-pagination__info"},[a("a",{domProps:{textContent:e._s(e.pageInfo)}})]):e._e(),e._v(" "),e.first?a("li",{class:{disabled:1===e.currentPage||e.disabled}},[a("a",{attrs:{href:"javascript:void(0);"},domProps:{textContent:e._s(e.i18n.first)},on:{click:function(t){return e.switchPage("first")}}})]):e._e(),e._v(" "),a("li",{class:{disabled:1===e.currentPage||e.disabled}},[a("a",{attrs:{href:"javascript:void(0);"},domProps:{textContent:e._s(e.i18n.previous)},on:{click:function(t){return e.switchPage("previous")}}})]),e._v(" "),e.pageNumber?e._l(e.pageNumbers,function(t,n){return a("li",{key:n,class:{active:t===e.currentPage,disabled:e.disabled&&t!==e.currentPage}},[a("a",{attrs:{href:"javascript:void(0);"},domProps:{textContent:e._s(t)},on:{click:function(a){return e.switchPage(t)}}})])}):e._e(),e._v(" "),a("li",{class:{disabled:e.currentPage===e.totalPage||e.disabled}},[a("a",{attrs:{href:"javascript:void(0);"},domProps:{textContent:e._s(e.i18n.next)},on:{click:function(t){return e.switchPage("next")}}})]),e._v(" "),e.last?a("li",{class:{disabled:e.currentPage===e.totalPage||e.disabled}},[a("a",{attrs:{href:"javascript:void(0);"},domProps:{textContent:e._s(e.i18n.last)},on:{click:function(t){return e.switchPage("last")}}})]):e._e()],2)])},i=[],o={render:n,staticRenderFns:i};t.a=o}])});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("vPage",[],t):"object"==typeof exports?exports.vPage=t():e.vPage=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(i){if(a[i])return a[i].exports;var n=a[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var a={};return t.m=e,t.c=a,t.d=function(e,a,i){t.o(e,a)||Object.defineProperty(e,a,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var a=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(a,"a",a),a},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=0)}([function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Page=void 0;var i=a(1),n=function(e){return e&&e.__esModule?e:{default:e}}(i);n.default.install=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Object.keys(t).length){var a=n.default.props,i=t.language,o=t.align,r=t.info,s=t.border,u=t.pageNumber,l=t.first,d=t.last,p=t.pageSizeMenu;i&&(a.language.default=i),o&&(a.align.default=o),"boolean"==typeof r&&(a.info.default=r),"boolean"==typeof s&&(a.border.default=s),"boolean"==typeof u&&(a.pageNumber.default=u),"boolean"==typeof l&&(a.first.default=l),"boolean"==typeof d&&(a.last.default=d),void 0!==p&&(a.pageSizeMenu.default=p)}e.component(n.default.name,n.default)},t.Page=n.default,t.default=n.default},function(e,t,a){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);t<e.length;t++)a[t]=e[t];return a}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0}),a(2);var n=a(7),o=function(e){return e&&e.__esModule?e:{default:e}}(n),r=a(8);t.default={name:"v-page",props:{value:{type:Number,default:0},totalRow:{type:Number,default:0},language:{type:String,default:"cn"},pageSizeMenu:{type:[Boolean,Array],default:function(){return r.defaultPageSizeMenu}},align:{type:String,default:"right"},disabled:{type:Boolean,default:!1},border:{type:Boolean,default:!0},info:{type:Boolean,default:!0},pageNumber:{type:Boolean,default:!0},first:{type:Boolean,default:!0},last:{type:Boolean,default:!0}},data:function(){return{current:0,pageSize:!1===this.pageSizeMenu?r.defaultPageSize:this.pageSizeMenu[0],pageNumberSize:r.defaultPageNumberSize,i18n:o.default[this.language]||o.default.cn,lastPageSize:-1}},computed:{totalPage:function(){return Math.ceil(this.totalRow/this.pageSize)},pageNumbers:function(){var e=this.current,t=this.pageNumberSize,a=this.totalPage,i=(0,r.getPageNumberStart)(e,a,t);return Array.apply(null,{length:t}).map(function(e,t){return i+t}).filter(function(e){return e>=r.FIRST&&e<=a})},pageInfo:function(){return this.i18n.pageInfo.replace("#pageNumber#",this.current).replace("#totalPage#",this.totalPage).replace("#totalRow#",this.totalRow)},classes:function(){return{"v-pagination":!0,"v-pagination--no-border":!this.border,"v-pagination--right":"right"===this.align,"v-pagination--center":"center"===this.align,"v-pagination--disabled":this.disabled}},isFirst:function(){return this.current===r.FIRST},isLast:function(){return this.current===this.totalPage}},watch:{value:function(e){"number"==typeof e&&e>0&&this.goPage(e,!1)}},render:function(e){var t=this,a=this.pageNumberGenerator,n=this.current,o=this.i18n,s=this.isFirst,u=this.isLast,l=[];if(Array.isArray(this.pageSizeMenu)&&this.pageSizeMenu.length&&l.push(e("li",{class:"v-pagination__list"},[e("a",[e("span",o.pageLength),e("select",{attrs:{disabled:this.disabled},on:{change:function(e){t.pageSize=Number(e.srcElement.value),t.goPage()}}},this.pageSizeMenu.map(function(t){return e("option",{attrs:{value:t}},t)}))])])),this.info&&l.push(e("li",{class:"v-pagination__info"},[e("a",this.pageInfo)])),this.first){var d={"v-pagination__first":!0,disabled:s};l.push(a(d,r.FIRST,o.first))}var p={"v-pagination__previous":!0,disabled:s};l.push(a(p,n-1,o.previous)),this.pageNumber&&l.push.apply(l,i(this.pageNumbers.map(function(e){return a({active:e===n},e,e)})));var g={"v-pagination__next":!0,disabled:u};if(l.push(a(g,n+1,o.next)),this.last){var f={"v-pagination__last":!0,disabled:u};l.push(a(f,this.totalPage,o.last))}return e("div",{class:this.classes},[e("ul",l)])},methods:{goPage:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.FIRST,t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.disabled&&"number"==typeof e){var a=e<r.FIRST?r.FIRST:e;e>this.totalPage&&this.totalPage>0&&(a=this.totalPage),a===this.current&&this.pageSize===this.lastPageSize||(this.current=a,t&&this.$emit("input",this.current),this.lastPageSize=this.pageSize,this.change())}},reload:function(){this.change()},change:function(){this.$emit("page-change",{pageNumber:this.current,pageSize:Number(this.pageSize)})},pageNumberGenerator:function(e,t,a){var i=this,n={attrs:{href:"javascript:void(0)"},on:{click:function(){return i.goPage(t)}}};return this.$createElement("li",{class:e},[this.$createElement("a",n,a)])}},mounted:function(){this.goPage(this.value||r.FIRST)}}},function(e,t,a){var i=a(3);i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);var n=a(5).default;n("271f52e6",i,!0,{})},function(e,t,a){t=e.exports=a(4)(!1),t.push([e.i,"div.v-pagination{margin:0;display:block}div.v-pagination.v-pagination--right{text-align:right}div.v-pagination.v-pagination--center{text-align:center}div.v-pagination.v-pagination--disabled li a{color:#999;cursor:default}div.v-pagination.v-pagination--disabled li a:hover{color:#999;background-color:#fff;box-shadow:none;z-index:auto}div.v-pagination.v-pagination--disabled li.active a{background-color:#f6f6f6}div.v-pagination>ul{display:inline-block;list-style:none;margin:0;padding:0;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:0 1px 2px rgba(0,0,0,.05);-ms-box-shadow:0 1px 2px rgba(0,0,0,.05);-o-box-shadow:0 1px 2px rgba(0,0,0,.05);box-shadow:0 1px 2px rgba(0,0,0,.05)}div.v-pagination>ul>li{text-align:center;margin:0;display:inline}div.v-pagination>ul>li>a{margin:0 0 0 -1px;outline:none;position:relative;border:1px solid #dee2e6;padding:6px 12px;line-height:1.43;box-shadow:none;background-color:#fff;font-size:14px;display:inline-block;text-decoration:none;color:#333;-webkit-transition:all .5s cubic-bezier(.175,.885,.32,1);-moz-transition:all .5s cubic-bezier(.175,.885,.32,1);-ms-transition:all .5s cubic-bezier(.175,.885,.32,1);-o-transition:all .5s cubic-bezier(.175,.885,.32,1);transition:all .5s cubic-bezier(.175,.885,.32,1)}div.v-pagination>ul>li>a:hover{z-index:2;-webkit-box-shadow:0 0 8px rgba(0,0,0,.2);-moz-box-shadow:0 0 8px rgba(0,0,0,.2);-ms-box-shadow:0 0 8px rgba(0,0,0,.2);-o-box-shadow:0 0 8px rgba(0,0,0,.2);box-shadow:0 0 8px rgba(0,0,0,.2)}div.v-pagination>ul>li.disabled>a,div.v-pagination>ul>li.v-pagination__info>a,div.v-pagination>ul>li.v-pagination__list>a{color:#999;cursor:default}div.v-pagination>ul>li.disabled>a:hover,div.v-pagination>ul>li.v-pagination__info>a:hover,div.v-pagination>ul>li.v-pagination__list>a:hover{color:#999;background-color:#fff;box-shadow:none;z-index:auto}div.v-pagination>ul>li.active>a{cursor:default;color:#999;background-color:#eee}div.v-pagination>ul>li.active>a:hover{box-shadow:none;z-index:auto}div.v-pagination>ul>li:first-child>a{border-left-width:1px;-webkit-border-bottom-left-radius:2px;-moz-border-bottom-left-radius:2px;-ms-border-bottom-left-radius:2px;-o-border-bottom-left-radius:2px;border-bottom-left-radius:2px;-webkit-border-top-left-radius:2px;-moz-border-top-left-radius:2px;-ms-border-top-left-radius:2px;-o-border-top-left-radius:2px;border-top-left-radius:2px}div.v-pagination>ul>li:last-child>a{-webkit-border-top-right-radius:2px;-moz-border-top-right-radius:2px;-ms-border-top-right-radius:2px;-o-border-top-right-radius:2px;border-top-right-radius:2px;-webkit-border-bottom-right-radius:2px;-moz-border-bottom-right-radius:2px;-ms-border-bottom-right-radius:2px;-o-border-bottom-right-radius:2px;border-bottom-right-radius:2px}div.v-pagination>ul>li.v-pagination__list select{margin-left:5px;width:auto!important;font-size:12px;padding:0;border:1px solid #ccc;color:#333;outline:0}div.v-pagination>ul>li.v-pagination__list select:hover{-webkit-box-shadow:0 0 2px rgba(0,0,0,.2);-moz-box-shadow:0 0 2px rgba(0,0,0,.2);-ms-box-shadow:0 0 2px rgba(0,0,0,.2);-o-box-shadow:0 0 2px rgba(0,0,0,.2);box-shadow:0 0 2px rgba(0,0,0,.2)}div.v-pagination>ul>li.v-pagination__list select[disabled]{color:#999}div.v-pagination.v-pagination--no-border>ul{box-shadow:none}div.v-pagination.v-pagination--no-border>ul>li:not(.active):not(.disabled):not(.v-pagination__info):not(.v-pagination__list) a:hover{box-shadow:none;z-index:auto;background-color:#ddd}div.v-pagination.v-pagination--no-border>ul>li.active a{background-color:#f6f6f6;color:#aaa}div.v-pagination.v-pagination--no-border>ul>li>a{border:0}div.v-pagination.v-pagination--no-border>ul>li>a:hover{z-index:auto}",""])},function(e,t){function a(e,t){var a=e[1]||"",n=e[3];if(!n)return a;if(t&&"function"==typeof btoa){var o=i(n);return[a].concat(n.sources.map(function(e){return"/*# sourceURL="+n.sourceRoot+e+" */"})).concat([o]).join("\n")}return[a].join("\n")}function i(e){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e))))+" */"}e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var i=a(t,e);return t[2]?"@media "+t[2]+"{"+i+"}":i}).join("")},t.i=function(e,a){"string"==typeof e&&(e=[[null,e,""]]);for(var i={},n=0;n<this.length;n++){var o=this[n][0];"number"==typeof o&&(i[o]=!0)}for(n=0;n<e.length;n++){var r=e[n];"number"==typeof r[0]&&i[r[0]]||(a&&!r[2]?r[2]=a:a&&(r[2]="("+r[2]+") and ("+a+")"),t.push(r))}},t}},function(e,t,a){"use strict";function i(e,t,a,i){v=a,b=i||{};var o=Object(l.a)(e,t);return n(o),function(t){for(var a=[],i=0;i<o.length;i++){var r=o[i],s=p[r.id];s.refs--,a.push(s)}t?(o=Object(l.a)(e,t),n(o)):o=[];for(var i=0;i<a.length;i++){var s=a[i];if(0===s.refs){for(var u=0;u<s.parts.length;u++)s.parts[u]();delete p[s.id]}}}}function n(e){for(var t=0;t<e.length;t++){var a=e[t],i=p[a.id];if(i){i.refs++;for(var n=0;n<i.parts.length;n++)i.parts[n](a.parts[n]);for(;n<a.parts.length;n++)i.parts.push(r(a.parts[n]));i.parts.length>a.parts.length&&(i.parts.length=a.parts.length)}else{for(var o=[],n=0;n<a.parts.length;n++)o.push(r(a.parts[n]));p[a.id]={id:a.id,refs:1,parts:o}}}}function o(){var e=document.createElement("style");return e.type="text/css",g.appendChild(e),e}function r(e){var t,a,i=document.querySelector("style["+m+'~="'+e.id+'"]');if(i){if(v)return h;i.parentNode.removeChild(i)}if(x){var n=c++;i=f||(f=o()),t=s.bind(null,i,n,!1),a=s.bind(null,i,n,!0)}else i=o(),t=u.bind(null,i),a=function(){i.parentNode.removeChild(i)};return t(e),function(i){if(i){if(i.css===e.css&&i.media===e.media&&i.sourceMap===e.sourceMap)return;t(e=i)}else a()}}function s(e,t,a,i){var n=a?"":i.css;if(e.styleSheet)e.styleSheet.cssText=y(t,n);else{var o=document.createTextNode(n),r=e.childNodes;r[t]&&e.removeChild(r[t]),r.length?e.insertBefore(o,r[t]):e.appendChild(o)}}function u(e,t){var a=t.css,i=t.media,n=t.sourceMap;if(i&&e.setAttribute("media",i),b.ssrId&&e.setAttribute(m,t.id),n&&(a+="\n/*# sourceURL="+n.sources[0]+" */",a+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(n))))+" */"),e.styleSheet)e.styleSheet.cssText=a;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(a))}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var l=a(6),d="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!d)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var p={},g=d&&(document.head||document.getElementsByTagName("head")[0]),f=null,c=0,v=!1,h=function(){},b=null,m="data-vue-ssr-id",x="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase()),y=function(){var e=[];return function(t,a){return e[t]=a,e.filter(Boolean).join("\n")}}()},function(e,t,a){"use strict";function i(e,t){for(var a=[],i={},n=0;n<t.length;n++){var o=t[n],r=o[0],s=o[1],u=o[2],l=o[3],d={id:e+":"+n,css:s,media:u,sourceMap:l};i[r]?i[r].parts.push(d):a.push(i[r]={id:r,parts:[d]})}return a}t.a=i},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={cn:{pageLength:"每页记录数 ",pageInfo:"当前显示第 #pageNumber# / #totalPage# 页(共#totalRow#条记录)",first:"首页",previous:"«",next:"»",last:"尾页"},en:{pageLength:"Page length ",pageInfo:"Current #pageNumber# / #totalPage# (total #totalRow# records)",first:"First",previous:"«",next:"»",last:"Last"},de:{pageLength:"Seitenlänge ",pageInfo:"Aktuell #pageNumber# / #totalPage# (gesamt #totalRow# Aufzeichnungen)",first:"Zuerst",previous:"«",next:"»",last:"Letzte"},jp:{pageLength:"ページごとの記録数",pageInfo:"現在の第 #pageNumber# / #totalPage# ページ(全部で #totalRow# 条の記録)",first:"トップページ",previous:"«",next:"»",last:"尾のページ"},pt:{pageLength:"Resultados por página ",pageInfo:"#pageNumber# / #totalPage# (total de #totalRow#)",first:"Início",previous:"<",next:">",last:"Fim"}}},function(e,t,a){"use strict";function i(e,t,a){if(t<=a)return n;var i=Math.floor(a/2),o=t-a+1,r=e-i;return r<n?n:r>o?o:r}Object.defineProperty(t,"__esModule",{value:!0}),t.getPageNumberStart=i;var n=t.FIRST=1,o=(t.defaultPageNumberSize=5,t.defaultPageSize=10);t.defaultPageSizeMenu=[o,20,50,100]}])});
|
|
2
2
|
//# sourceMappingURL=v-page.js.map
|