1 | module.exports =
|
2 | (function(modules) {
|
3 |
|
4 | var installedModules = {};
|
5 |
|
6 |
|
7 | function __webpack_require__(moduleId) {
|
8 |
|
9 |
|
10 | if(installedModules[moduleId]) {
|
11 | return installedModules[moduleId].exports;
|
12 | }
|
13 |
|
14 | var module = installedModules[moduleId] = {
|
15 | i: moduleId,
|
16 | l: false,
|
17 | exports: {}
|
18 | };
|
19 |
|
20 |
|
21 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
22 |
|
23 |
|
24 | module.l = true;
|
25 |
|
26 |
|
27 | return module.exports;
|
28 | }
|
29 |
|
30 |
|
31 |
|
32 | __webpack_require__.m = modules;
|
33 |
|
34 |
|
35 | __webpack_require__.c = installedModules;
|
36 |
|
37 |
|
38 | __webpack_require__.d = function(exports, name, getter) {
|
39 | if(!__webpack_require__.o(exports, name)) {
|
40 | Object.defineProperty(exports, name, {
|
41 | configurable: false,
|
42 | enumerable: true,
|
43 | get: getter
|
44 | /******/ });
|
45 | /******/ }
|
46 | /******/ };
|
47 | /******/
|
48 | /******/ // getDefaultExport function for compatibility with non-harmony modules
|
49 | /******/ __webpack_require__.n = function(module) {
|
50 | var getter = module && module.__esModule ?
|
51 | function getDefault() { return module['default']; } :
|
52 | function getModuleExports() { return module; };
|
53 | __webpack_require__.d(getter, 'a', getter);
|
54 | return getter;
|
55 | };
|
56 |
|
57 |
|
58 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
59 |
|
60 |
|
61 | __webpack_require__.p = "/dist/";
|
62 |
|
63 |
|
64 | return __webpack_require__(__webpack_require__.s = 54);
|
65 | })
|
66 |
|
67 | ({
|
68 |
|
69 | 0:
|
70 | (function(module, exports) {
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 | module.exports = function normalizeComponent (
|
79 | rawScriptExports,
|
80 | compiledTemplate,
|
81 | functionalTemplate,
|
82 | injectStyles,
|
83 | scopeId,
|
84 | moduleIdentifier /* server only */
|
85 | ) {
|
86 | var esModule
|
87 | var scriptExports = rawScriptExports = rawScriptExports || {}
|
88 |
|
89 |
|
90 | var type = typeof rawScriptExports.default
|
91 | if (type === 'object' || type === 'function') {
|
92 | esModule = rawScriptExports
|
93 | scriptExports = rawScriptExports.default
|
94 | }
|
95 |
|
96 |
|
97 | var options = typeof scriptExports === 'function'
|
98 | ? scriptExports.options
|
99 | : scriptExports
|
100 |
|
101 |
|
102 | if (compiledTemplate) {
|
103 | options.render = compiledTemplate.render
|
104 | options.staticRenderFns = compiledTemplate.staticRenderFns
|
105 | options._compiled = true
|
106 | }
|
107 |
|
108 |
|
109 | if (functionalTemplate) {
|
110 | options.functional = true
|
111 | }
|
112 |
|
113 |
|
114 | if (scopeId) {
|
115 | options._scopeId = scopeId
|
116 | }
|
117 |
|
118 | var hook
|
119 | if (moduleIdentifier) {
|
120 | hook = function (context) {
|
121 |
|
122 | context =
|
123 | context ||
|
124 | (this.$vnode && this.$vnode.ssrContext) ||
|
125 | (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext)
|
126 |
|
127 | if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
128 | context = __VUE_SSR_CONTEXT__
|
129 | }
|
130 |
|
131 | if (injectStyles) {
|
132 | injectStyles.call(this, context)
|
133 | }
|
134 |
|
135 | if (context && context._registeredComponents) {
|
136 | context._registeredComponents.add(moduleIdentifier)
|
137 | }
|
138 | }
|
139 |
|
140 |
|
141 | options._ssrRegister = hook
|
142 | } else if (injectStyles) {
|
143 | hook = injectStyles
|
144 | }
|
145 |
|
146 | if (hook) {
|
147 | var functional = options.functional
|
148 | var existing = functional
|
149 | ? options.render
|
150 | : options.beforeCreate
|
151 |
|
152 | if (!functional) {
|
153 |
|
154 | options.beforeCreate = existing
|
155 | ? [].concat(existing, hook)
|
156 | : [hook]
|
157 | } else {
|
158 |
|
159 |
|
160 | options._injectStyles = hook
|
161 |
|
162 | options.render = function renderWithStyleInjection (h, context) {
|
163 | hook.call(context)
|
164 | return existing(h, context)
|
165 | }
|
166 | }
|
167 | }
|
168 |
|
169 | return {
|
170 | esModule: esModule,
|
171 | exports: scriptExports,
|
172 | options: options
|
173 | }
|
174 | }
|
175 |
|
176 |
|
177 | }),
|
178 |
|
179 | 2:
|
180 | (function(module, exports) {
|
181 |
|
182 | module.exports = require("element-ui/lib/utils/util");
|
183 |
|
184 | }),
|
185 |
|
186 | 5:
|
187 | (function(module, exports) {
|
188 |
|
189 | module.exports = require("element-ui/lib/mixins/locale");
|
190 |
|
191 | }),
|
192 |
|
193 | 54:
|
194 | (function(module, exports, __webpack_require__) {
|
195 |
|
196 | "use strict";
|
197 |
|
198 |
|
199 | exports.__esModule = true;
|
200 |
|
201 | var _pagination = __webpack_require__(55);
|
202 |
|
203 | var _pagination2 = _interopRequireDefault(_pagination);
|
204 |
|
205 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
206 |
|
207 |
|
208 | _pagination2.default.install = function (Vue) {
|
209 | Vue.component(_pagination2.default.name, _pagination2.default);
|
210 | };
|
211 |
|
212 | exports.default = _pagination2.default;
|
213 |
|
214 | }),
|
215 |
|
216 | 55:
|
217 | (function(module, exports, __webpack_require__) {
|
218 |
|
219 | "use strict";
|
220 |
|
221 |
|
222 | exports.__esModule = true;
|
223 |
|
224 | var _pager = __webpack_require__(56);
|
225 |
|
226 | var _pager2 = _interopRequireDefault(_pager);
|
227 |
|
228 | var _select = __webpack_require__(59);
|
229 |
|
230 | var _select2 = _interopRequireDefault(_select);
|
231 |
|
232 | var _option = __webpack_require__(60);
|
233 |
|
234 | var _option2 = _interopRequireDefault(_option);
|
235 |
|
236 | var _input = __webpack_require__(6);
|
237 |
|
238 | var _input2 = _interopRequireDefault(_input);
|
239 |
|
240 | var _locale = __webpack_require__(5);
|
241 |
|
242 | var _locale2 = _interopRequireDefault(_locale);
|
243 |
|
244 | var _util = __webpack_require__(2);
|
245 |
|
246 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
247 |
|
248 | exports.default = {
|
249 | name: 'ElPagination',
|
250 |
|
251 | props: {
|
252 | pageSize: {
|
253 | type: Number,
|
254 | default: 10
|
255 | },
|
256 |
|
257 | small: Boolean,
|
258 |
|
259 | total: Number,
|
260 |
|
261 | pageCount: Number,
|
262 |
|
263 | pagerCount: {
|
264 | type: Number,
|
265 | validator: function validator(value) {
|
266 | return (value | 0) === value && value > 4 && value < 22 && value % 2 === 1;
|
267 | },
|
268 |
|
269 | default: 7
|
270 | },
|
271 |
|
272 | currentPage: {
|
273 | type: Number,
|
274 | default: 1
|
275 | },
|
276 |
|
277 | layout: {
|
278 | default: 'prev, pager, next, jumper, ->, total'
|
279 | },
|
280 |
|
281 | pageSizes: {
|
282 | type: Array,
|
283 | default: function _default() {
|
284 | return [10, 20, 30, 40, 50, 100];
|
285 | }
|
286 | },
|
287 |
|
288 | popperClass: String,
|
289 |
|
290 | prevText: String,
|
291 |
|
292 | nextText: String,
|
293 |
|
294 | background: Boolean,
|
295 |
|
296 | disabled: Boolean
|
297 | },
|
298 |
|
299 | data: function data() {
|
300 | return {
|
301 | internalCurrentPage: 1,
|
302 | internalPageSize: 0,
|
303 | lastEmittedPage: -1,
|
304 | userChangePageSize: false
|
305 | };
|
306 | },
|
307 | render: function render(h) {
|
308 | var template = h(
|
309 | 'div',
|
310 | { 'class': ['el-pagination', {
|
311 | 'is-background': this.background,
|
312 | 'el-pagination--small': this.small
|
313 | }] },
|
314 | []
|
315 | );
|
316 | var layout = this.layout || '';
|
317 | if (!layout) return;
|
318 | var TEMPLATE_MAP = {
|
319 | prev: h(
|
320 | 'prev',
|
321 | null,
|
322 | []
|
323 | ),
|
324 | jumper: h(
|
325 | 'jumper',
|
326 | null,
|
327 | []
|
328 | ),
|
329 | pager: h(
|
330 | 'pager',
|
331 | {
|
332 | attrs: { currentPage: this.internalCurrentPage, pageCount: this.internalPageCount, pagerCount: this.pagerCount, disabled: this.disabled },
|
333 | on: {
|
334 | 'change': this.handleCurrentChange
|
335 | }
|
336 | },
|
337 | []
|
338 | ),
|
339 | next: h(
|
340 | 'next',
|
341 | null,
|
342 | []
|
343 | ),
|
344 | sizes: h(
|
345 | 'sizes',
|
346 | {
|
347 | attrs: { pageSizes: this.pageSizes }
|
348 | },
|
349 | []
|
350 | ),
|
351 | slot: h(
|
352 | 'my-slot',
|
353 | null,
|
354 | []
|
355 | ),
|
356 | total: h(
|
357 | 'total',
|
358 | null,
|
359 | []
|
360 | )
|
361 | };
|
362 | var components = layout.split(',').map(function (item) {
|
363 | return item.trim();
|
364 | });
|
365 | var rightWrapper = h(
|
366 | 'div',
|
367 | { 'class': 'el-pagination__rightwrapper' },
|
368 | []
|
369 | );
|
370 | var haveRightWrapper = false;
|
371 |
|
372 | template.children = template.children || [];
|
373 | rightWrapper.children = rightWrapper.children || [];
|
374 | components.forEach(function (compo) {
|
375 | if (compo === '->') {
|
376 | haveRightWrapper = true;
|
377 | return;
|
378 | }
|
379 |
|
380 | if (!haveRightWrapper) {
|
381 | template.children.push(TEMPLATE_MAP[compo]);
|
382 | } else {
|
383 | rightWrapper.children.push(TEMPLATE_MAP[compo]);
|
384 | }
|
385 | });
|
386 |
|
387 | if (haveRightWrapper) {
|
388 | template.children.unshift(rightWrapper);
|
389 | }
|
390 |
|
391 | return template;
|
392 | },
|
393 |
|
394 |
|
395 | components: {
|
396 | MySlot: {
|
397 | render: function render(h) {
|
398 | return this.$parent.$slots.default ? this.$parent.$slots.default[0] : '';
|
399 | }
|
400 | },
|
401 | Prev: {
|
402 | render: function render(h) {
|
403 | return h(
|
404 | 'button',
|
405 | {
|
406 | attrs: {
|
407 | type: 'button',
|
408 |
|
409 | disabled: this.$parent.disabled || this.$parent.internalCurrentPage <= 1
|
410 | },
|
411 | 'class': 'btn-prev', on: {
|
412 | 'click': this.$parent.prev
|
413 | }
|
414 | },
|
415 | [this.$parent.prevText ? h(
|
416 | 'span',
|
417 | null,
|
418 | [this.$parent.prevText]
|
419 | ) : h(
|
420 | 'i',
|
421 | { 'class': 'el-icon el-icon-arrow-left' },
|
422 | []
|
423 | )]
|
424 | );
|
425 | }
|
426 | },
|
427 |
|
428 | Next: {
|
429 | render: function render(h) {
|
430 | return h(
|
431 | 'button',
|
432 | {
|
433 | attrs: {
|
434 | type: 'button',
|
435 |
|
436 | disabled: this.$parent.disabled || this.$parent.internalCurrentPage === this.$parent.internalPageCount || this.$parent.internalPageCount === 0
|
437 | },
|
438 | 'class': 'btn-next', on: {
|
439 | 'click': this.$parent.next
|
440 | }
|
441 | },
|
442 | [this.$parent.nextText ? h(
|
443 | 'span',
|
444 | null,
|
445 | [this.$parent.nextText]
|
446 | ) : h(
|
447 | 'i',
|
448 | { 'class': 'el-icon el-icon-arrow-right' },
|
449 | []
|
450 | )]
|
451 | );
|
452 | }
|
453 | },
|
454 |
|
455 | Sizes: {
|
456 | mixins: [_locale2.default],
|
457 |
|
458 | props: {
|
459 | pageSizes: Array
|
460 | },
|
461 |
|
462 | watch: {
|
463 | pageSizes: {
|
464 | immediate: true,
|
465 | handler: function handler(newVal, oldVal) {
|
466 | if ((0, _util.valueEquals)(newVal, oldVal)) return;
|
467 | if (Array.isArray(newVal)) {
|
468 | this.$parent.internalPageSize = newVal.indexOf(this.$parent.pageSize) > -1 ? this.$parent.pageSize : this.pageSizes[0];
|
469 | }
|
470 | }
|
471 | }
|
472 | },
|
473 |
|
474 | render: function render(h) {
|
475 | var _this = this;
|
476 |
|
477 | return h(
|
478 | 'span',
|
479 | { 'class': 'el-pagination__sizes' },
|
480 | [h(
|
481 | 'el-select',
|
482 | {
|
483 | attrs: {
|
484 | value: this.$parent.internalPageSize,
|
485 | popperClass: this.$parent.popperClass || '',
|
486 | size: 'mini',
|
487 |
|
488 | disabled: this.$parent.disabled },
|
489 | on: {
|
490 | 'input': this.handleChange
|
491 | }
|
492 | },
|
493 | [this.pageSizes.map(function (item) {
|
494 | return h(
|
495 | 'el-option',
|
496 | {
|
497 | attrs: {
|
498 | value: item,
|
499 | label: item + _this.t('el.pagination.pagesize') }
|
500 | },
|
501 | []
|
502 | );
|
503 | })]
|
504 | )]
|
505 | );
|
506 | },
|
507 |
|
508 |
|
509 | components: {
|
510 | ElSelect: _select2.default,
|
511 | ElOption: _option2.default
|
512 | },
|
513 |
|
514 | methods: {
|
515 | handleChange: function handleChange(val) {
|
516 | if (val !== this.$parent.internalPageSize) {
|
517 | this.$parent.internalPageSize = val = parseInt(val, 10);
|
518 | this.$parent.userChangePageSize = true;
|
519 | this.$parent.$emit('update:pageSize', val);
|
520 | this.$parent.$emit('size-change', val);
|
521 | }
|
522 | }
|
523 | }
|
524 | },
|
525 |
|
526 | Jumper: {
|
527 | mixins: [_locale2.default],
|
528 |
|
529 | data: function data() {
|
530 | return {
|
531 | oldValue: null
|
532 | };
|
533 | },
|
534 |
|
535 |
|
536 | components: { ElInput: _input2.default },
|
537 |
|
538 | watch: {
|
539 | '$parent.internalPageSize': function $parentInternalPageSize() {
|
540 | var _this2 = this;
|
541 |
|
542 | this.$nextTick(function () {
|
543 | _this2.$refs.input.$el.querySelector('input').value = _this2.$parent.internalCurrentPage;
|
544 | });
|
545 | }
|
546 | },
|
547 |
|
548 | methods: {
|
549 | handleFocus: function handleFocus(event) {
|
550 | this.oldValue = event.target.value;
|
551 | },
|
552 | handleBlur: function handleBlur(_ref) {
|
553 | var target = _ref.target;
|
554 |
|
555 | this.resetValueIfNeed(target.value);
|
556 | this.reassignMaxValue(target.value);
|
557 | },
|
558 | handleKeyup: function handleKeyup(_ref2) {
|
559 | var keyCode = _ref2.keyCode,
|
560 | target = _ref2.target;
|
561 |
|
562 | if (keyCode === 13 && this.oldValue && target.value !== this.oldValue) {
|
563 | this.handleChange(target.value);
|
564 | }
|
565 | },
|
566 | handleChange: function handleChange(value) {
|
567 | this.$parent.internalCurrentPage = this.$parent.getValidCurrentPage(value);
|
568 | this.$parent.emitChange();
|
569 | this.oldValue = null;
|
570 | this.resetValueIfNeed(value);
|
571 | },
|
572 | resetValueIfNeed: function resetValueIfNeed(value) {
|
573 | var num = parseInt(value, 10);
|
574 | if (!isNaN(num)) {
|
575 | if (num < 1) {
|
576 | this.$refs.input.setCurrentValue(1);
|
577 | } else {
|
578 | this.reassignMaxValue(value);
|
579 | }
|
580 | }
|
581 | },
|
582 | reassignMaxValue: function reassignMaxValue(value) {
|
583 | var internalPageCount = this.$parent.internalPageCount;
|
584 |
|
585 | if (+value > internalPageCount) {
|
586 | this.$refs.input.setCurrentValue(internalPageCount || 1);
|
587 | }
|
588 | }
|
589 | },
|
590 |
|
591 | render: function render(h) {
|
592 | return h(
|
593 | 'span',
|
594 | { 'class': 'el-pagination__jump' },
|
595 | [this.t('el.pagination.goto'), h(
|
596 | 'el-input',
|
597 | {
|
598 | 'class': 'el-pagination__editor is-in-pagination',
|
599 | attrs: { min: 1,
|
600 | max: this.$parent.internalPageCount,
|
601 | value: this.$parent.internalCurrentPage,
|
602 |
|
603 | type: 'number',
|
604 |
|
605 | disabled: this.$parent.disabled
|
606 | },
|
607 | domProps: {
|
608 | 'value': this.$parent.internalCurrentPage
|
609 | },
|
610 | ref: 'input', nativeOn: {
|
611 | 'keyup': this.handleKeyup
|
612 | },
|
613 | on: {
|
614 | 'change': this.handleChange,
|
615 | 'focus': this.handleFocus,
|
616 | 'blur': this.handleBlur
|
617 | }
|
618 | },
|
619 | []
|
620 | ), this.t('el.pagination.pageClassifier')]
|
621 | );
|
622 | }
|
623 | },
|
624 |
|
625 | Total: {
|
626 | mixins: [_locale2.default],
|
627 |
|
628 | render: function render(h) {
|
629 | return typeof this.$parent.total === 'number' ? h(
|
630 | 'span',
|
631 | { 'class': 'el-pagination__total' },
|
632 | [this.t('el.pagination.total', { total: this.$parent.total })]
|
633 | ) : '';
|
634 | }
|
635 | },
|
636 |
|
637 | Pager: _pager2.default
|
638 | },
|
639 |
|
640 | methods: {
|
641 | handleCurrentChange: function handleCurrentChange(val) {
|
642 | this.internalCurrentPage = this.getValidCurrentPage(val);
|
643 | this.userChangePageSize = true;
|
644 | this.emitChange();
|
645 | },
|
646 | prev: function prev() {
|
647 | if (this.disabled) return;
|
648 | var newVal = this.internalCurrentPage - 1;
|
649 | this.internalCurrentPage = this.getValidCurrentPage(newVal);
|
650 | this.$emit('prev-click', this.internalCurrentPage);
|
651 | this.emitChange();
|
652 | },
|
653 | next: function next() {
|
654 | if (this.disabled) return;
|
655 | var newVal = this.internalCurrentPage + 1;
|
656 | this.internalCurrentPage = this.getValidCurrentPage(newVal);
|
657 | this.$emit('next-click', this.internalCurrentPage);
|
658 | this.emitChange();
|
659 | },
|
660 | getValidCurrentPage: function getValidCurrentPage(value) {
|
661 | value = parseInt(value, 10);
|
662 |
|
663 | var havePageCount = typeof this.internalPageCount === 'number';
|
664 |
|
665 | var resetValue = void 0;
|
666 | if (!havePageCount) {
|
667 | if (isNaN(value) || value < 1) resetValue = 1;
|
668 | } else {
|
669 | if (value < 1) {
|
670 | resetValue = 1;
|
671 | } else if (value > this.internalPageCount) {
|
672 | resetValue = this.internalPageCount;
|
673 | }
|
674 | }
|
675 |
|
676 | if (resetValue === undefined && isNaN(value)) {
|
677 | resetValue = 1;
|
678 | } else if (resetValue === 0) {
|
679 | resetValue = 1;
|
680 | }
|
681 |
|
682 | return resetValue === undefined ? value : resetValue;
|
683 | },
|
684 | emitChange: function emitChange() {
|
685 | var _this3 = this;
|
686 |
|
687 | this.$nextTick(function () {
|
688 | if (_this3.internalCurrentPage !== _this3.lastEmittedPage || _this3.userChangePageSize) {
|
689 | _this3.$emit('current-change', _this3.internalCurrentPage);
|
690 | _this3.lastEmittedPage = _this3.internalCurrentPage;
|
691 | _this3.userChangePageSize = false;
|
692 | }
|
693 | });
|
694 | }
|
695 | },
|
696 |
|
697 | computed: {
|
698 | internalPageCount: function internalPageCount() {
|
699 | if (typeof this.total === 'number') {
|
700 | return Math.ceil(this.total / this.internalPageSize);
|
701 | } else if (typeof this.pageCount === 'number') {
|
702 | return this.pageCount;
|
703 | }
|
704 | return null;
|
705 | }
|
706 | },
|
707 |
|
708 | watch: {
|
709 | currentPage: {
|
710 | immediate: true,
|
711 | handler: function handler(val) {
|
712 | this.internalCurrentPage = val;
|
713 | }
|
714 | },
|
715 |
|
716 | pageSize: {
|
717 | immediate: true,
|
718 | handler: function handler(val) {
|
719 | this.internalPageSize = isNaN(val) ? 10 : val;
|
720 | }
|
721 | },
|
722 |
|
723 | internalCurrentPage: {
|
724 | immediate: true,
|
725 | handler: function handler(newVal, oldVal) {
|
726 | newVal = parseInt(newVal, 10);
|
727 |
|
728 |
|
729 | if (isNaN(newVal)) {
|
730 | newVal = oldVal || 1;
|
731 | } else {
|
732 | newVal = this.getValidCurrentPage(newVal);
|
733 | }
|
734 |
|
735 | if (newVal !== undefined) {
|
736 | this.internalCurrentPage = newVal;
|
737 | if (oldVal !== newVal) {
|
738 | this.$emit('update:currentPage', newVal);
|
739 | }
|
740 | } else {
|
741 | this.$emit('update:currentPage', newVal);
|
742 | }
|
743 | this.lastEmittedPage = -1;
|
744 | }
|
745 | },
|
746 |
|
747 | internalPageCount: function internalPageCount(newVal) {
|
748 |
|
749 | var oldPage = this.internalCurrentPage;
|
750 | if (newVal > 0 && oldPage === 0) {
|
751 | this.internalCurrentPage = 1;
|
752 | } else if (oldPage > newVal) {
|
753 | this.internalCurrentPage = newVal === 0 ? 1 : newVal;
|
754 | this.userChangePageSize && this.emitChange();
|
755 | }
|
756 | this.userChangePageSize = false;
|
757 | }
|
758 | }
|
759 | };
|
760 |
|
761 | }),
|
762 |
|
763 | 56:
|
764 | (function(module, __webpack_exports__, __webpack_require__) {
|
765 |
|
766 | "use strict";
|
767 | Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
768 | var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_pager_vue__ = __webpack_require__(57);
|
769 | var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_pager_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_pager_vue__);
|
770 | var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_046e52c4_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_pager_vue__ = __webpack_require__(58);
|
771 | var normalizeComponent = __webpack_require__(0)
|
772 |
|
773 |
|
774 |
|
775 |
|
776 |
|
777 | var __vue_template_functional__ = false
|
778 |
|
779 | var __vue_styles__ = null
|
780 |
|
781 | var __vue_scopeId__ = null
|
782 |
|
783 | var __vue_module_identifier__ = null
|
784 | var Component = normalizeComponent(
|
785 | __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_pager_vue___default.a,
|
786 | __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_046e52c4_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_pager_vue__["a" ],
|
787 | __vue_template_functional__,
|
788 | __vue_styles__,
|
789 | __vue_scopeId__,
|
790 | __vue_module_identifier__
|
791 | )
|
792 |
|
793 | __webpack_exports__["default"] = (Component.exports);
|
794 |
|
795 |
|
796 | }),
|
797 |
|
798 | 57:
|
799 | (function(module, exports, __webpack_require__) {
|
800 |
|
801 | "use strict";
|
802 |
|
803 |
|
804 | exports.__esModule = true;
|
805 |
|
806 |
|
807 |
|
808 |
|
809 |
|
810 |
|
811 |
|
812 |
|
813 |
|
814 |
|
815 |
|
816 |
|
817 |
|
818 |
|
819 |
|
820 |
|
821 |
|
822 |
|
823 |
|
824 |
|
825 |
|
826 |
|
827 |
|
828 |
|
829 |
|
830 |
|
831 |
|
832 |
|
833 |
|
834 |
|
835 |
|
836 |
|
837 |
|
838 | exports.default = {
|
839 | name: 'ElPager',
|
840 |
|
841 | props: {
|
842 | currentPage: Number,
|
843 |
|
844 | pageCount: Number,
|
845 |
|
846 | pagerCount: Number,
|
847 |
|
848 | disabled: Boolean
|
849 | },
|
850 |
|
851 | watch: {
|
852 | showPrevMore: function showPrevMore(val) {
|
853 | if (!val) this.quickprevIconClass = 'el-icon-more';
|
854 | },
|
855 | showNextMore: function showNextMore(val) {
|
856 | if (!val) this.quicknextIconClass = 'el-icon-more';
|
857 | }
|
858 | },
|
859 |
|
860 | methods: {
|
861 | onPagerClick: function onPagerClick(event) {
|
862 | var target = event.target;
|
863 | if (target.tagName === 'UL' || this.disabled) {
|
864 | return;
|
865 | }
|
866 |
|
867 | var newPage = Number(event.target.textContent);
|
868 | var pageCount = this.pageCount;
|
869 | var currentPage = this.currentPage;
|
870 | var pagerCountOffset = this.pagerCount - 2;
|
871 |
|
872 | if (target.className.indexOf('more') !== -1) {
|
873 | if (target.className.indexOf('quickprev') !== -1) {
|
874 | newPage = currentPage - pagerCountOffset;
|
875 | } else if (target.className.indexOf('quicknext') !== -1) {
|
876 | newPage = currentPage + pagerCountOffset;
|
877 | }
|
878 | }
|
879 |
|
880 |
|
881 | if (!isNaN(newPage)) {
|
882 | if (newPage < 1) {
|
883 | newPage = 1;
|
884 | }
|
885 |
|
886 | if (newPage > pageCount) {
|
887 | newPage = pageCount;
|
888 | }
|
889 | }
|
890 |
|
891 | if (newPage !== currentPage) {
|
892 | this.$emit('change', newPage);
|
893 | }
|
894 | },
|
895 | onMouseenter: function onMouseenter(direction) {
|
896 | if (this.disabled) return;
|
897 | if (direction === 'left') {
|
898 | this.quickprevIconClass = 'el-icon-d-arrow-left';
|
899 | } else {
|
900 | this.quicknextIconClass = 'el-icon-d-arrow-right';
|
901 | }
|
902 | }
|
903 | },
|
904 |
|
905 | computed: {
|
906 | pagers: function pagers() {
|
907 | var pagerCount = this.pagerCount;
|
908 | var halfPagerCount = (pagerCount - 1) / 2;
|
909 |
|
910 | var currentPage = Number(this.currentPage);
|
911 | var pageCount = Number(this.pageCount);
|
912 |
|
913 | var showPrevMore = false;
|
914 | var showNextMore = false;
|
915 |
|
916 | if (pageCount > pagerCount) {
|
917 | if (currentPage > pagerCount - halfPagerCount) {
|
918 | showPrevMore = true;
|
919 | }
|
920 |
|
921 | if (currentPage < pageCount - halfPagerCount) {
|
922 | showNextMore = true;
|
923 | }
|
924 | }
|
925 |
|
926 | var array = [];
|
927 |
|
928 | if (showPrevMore && !showNextMore) {
|
929 | var startPage = pageCount - (pagerCount - 2);
|
930 | for (var i = startPage; i < pageCount; i++) {
|
931 | array.push(i);
|
932 | }
|
933 | } else if (!showPrevMore && showNextMore) {
|
934 | for (var _i = 2; _i < pagerCount; _i++) {
|
935 | array.push(_i);
|
936 | }
|
937 | } else if (showPrevMore && showNextMore) {
|
938 | var offset = Math.floor(pagerCount / 2) - 1;
|
939 | for (var _i2 = currentPage - offset; _i2 <= currentPage + offset; _i2++) {
|
940 | array.push(_i2);
|
941 | }
|
942 | } else {
|
943 | for (var _i3 = 2; _i3 < pageCount; _i3++) {
|
944 | array.push(_i3);
|
945 | }
|
946 | }
|
947 |
|
948 | this.showPrevMore = showPrevMore;
|
949 | this.showNextMore = showNextMore;
|
950 |
|
951 | return array;
|
952 | }
|
953 | },
|
954 |
|
955 | data: function data() {
|
956 | return {
|
957 | current: null,
|
958 | showPrevMore: false,
|
959 | showNextMore: false,
|
960 | quicknextIconClass: 'el-icon-more',
|
961 | quickprevIconClass: 'el-icon-more'
|
962 | };
|
963 | }
|
964 | };
|
965 |
|
966 | }),
|
967 |
|
968 | 58:
|
969 | (function(module, __webpack_exports__, __webpack_require__) {
|
970 |
|
971 | "use strict";
|
972 | var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('ul',{staticClass:"el-pager",on:{"click":_vm.onPagerClick}},[(_vm.pageCount > 0)?_c('li',{staticClass:"number",class:{ active: _vm.currentPage === 1, disabled: _vm.disabled }},[_vm._v("1")]):_vm._e(),(_vm.showPrevMore)?_c('li',{staticClass:"el-icon more btn-quickprev",class:[_vm.quickprevIconClass, { disabled: _vm.disabled }],on:{"mouseenter":function($event){_vm.onMouseenter('left')},"mouseleave":function($event){_vm.quickprevIconClass = 'el-icon-more'}}}):_vm._e(),_vm._l((_vm.pagers),function(pager){return _c('li',{key:pager,staticClass:"number",class:{ active: _vm.currentPage === pager, disabled: _vm.disabled }},[_vm._v(_vm._s(pager))])}),(_vm.showNextMore)?_c('li',{staticClass:"el-icon more btn-quicknext",class:[_vm.quicknextIconClass, { disabled: _vm.disabled }],on:{"mouseenter":function($event){_vm.onMouseenter('right')},"mouseleave":function($event){_vm.quicknextIconClass = 'el-icon-more'}}}):_vm._e(),(_vm.pageCount > 1)?_c('li',{staticClass:"number",class:{ active: _vm.currentPage === _vm.pageCount, disabled: _vm.disabled }},[_vm._v(_vm._s(_vm.pageCount))]):_vm._e()],2)}
|
973 | var staticRenderFns = []
|
974 | var esExports = { render: render, staticRenderFns: staticRenderFns }
|
975 | __webpack_exports__["a"] = (esExports);
|
976 |
|
977 | }),
|
978 |
|
979 | 59:
|
980 | (function(module, exports) {
|
981 |
|
982 | module.exports = require("element-ui/lib/select");
|
983 |
|
984 | }),
|
985 |
|
986 | 6:
|
987 | (function(module, exports) {
|
988 |
|
989 | module.exports = require("element-ui/lib/input");
|
990 |
|
991 | }),
|
992 |
|
993 | 60:
|
994 | (function(module, exports) {
|
995 |
|
996 | module.exports = require("element-ui/lib/option");
|
997 |
|
998 | })
|
999 |
|
1000 | }); |
\ | No newline at end of file |