pagination.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927
  1. module.exports =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/
  6. /******/ // The require function
  7. /******/ function __webpack_require__(moduleId) {
  8. /******/
  9. /******/ // Check if module is in cache
  10. /******/ if(installedModules[moduleId]) {
  11. /******/ return installedModules[moduleId].exports;
  12. /******/ }
  13. /******/ // Create a new module (and put it into the cache)
  14. /******/ var module = installedModules[moduleId] = {
  15. /******/ i: moduleId,
  16. /******/ l: false,
  17. /******/ exports: {}
  18. /******/ };
  19. /******/
  20. /******/ // Execute the module function
  21. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22. /******/
  23. /******/ // Flag the module as loaded
  24. /******/ module.l = true;
  25. /******/
  26. /******/ // Return the exports of the module
  27. /******/ return module.exports;
  28. /******/ }
  29. /******/
  30. /******/
  31. /******/ // expose the modules object (__webpack_modules__)
  32. /******/ __webpack_require__.m = modules;
  33. /******/
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/
  37. /******/ // define getter function for harmony exports
  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. /******/ // Object.prototype.hasOwnProperty.call
  58. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  59. /******/
  60. /******/ // __webpack_public_path__
  61. /******/ __webpack_require__.p = "/dist/";
  62. /******/
  63. /******/ // Load entry module and return exports
  64. /******/ return __webpack_require__(__webpack_require__.s = 52);
  65. /******/ })
  66. /************************************************************************/
  67. /******/ ({
  68. /***/ 0:
  69. /***/ (function(module, exports) {
  70. /* globals __VUE_SSR_CONTEXT__ */
  71. // IMPORTANT: Do NOT use ES2015 features in this file.
  72. // This module is a runtime utility for cleaner component module output and will
  73. // be included in the final webpack user bundle.
  74. module.exports = function normalizeComponent (
  75. rawScriptExports,
  76. compiledTemplate,
  77. functionalTemplate,
  78. injectStyles,
  79. scopeId,
  80. moduleIdentifier /* server only */
  81. ) {
  82. var esModule
  83. var scriptExports = rawScriptExports = rawScriptExports || {}
  84. // ES6 modules interop
  85. var type = typeof rawScriptExports.default
  86. if (type === 'object' || type === 'function') {
  87. esModule = rawScriptExports
  88. scriptExports = rawScriptExports.default
  89. }
  90. // Vue.extend constructor export interop
  91. var options = typeof scriptExports === 'function'
  92. ? scriptExports.options
  93. : scriptExports
  94. // render functions
  95. if (compiledTemplate) {
  96. options.render = compiledTemplate.render
  97. options.staticRenderFns = compiledTemplate.staticRenderFns
  98. options._compiled = true
  99. }
  100. // functional template
  101. if (functionalTemplate) {
  102. options.functional = true
  103. }
  104. // scopedId
  105. if (scopeId) {
  106. options._scopeId = scopeId
  107. }
  108. var hook
  109. if (moduleIdentifier) { // server build
  110. hook = function (context) {
  111. // 2.3 injection
  112. context =
  113. context || // cached call
  114. (this.$vnode && this.$vnode.ssrContext) || // stateful
  115. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  116. // 2.2 with runInNewContext: true
  117. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  118. context = __VUE_SSR_CONTEXT__
  119. }
  120. // inject component styles
  121. if (injectStyles) {
  122. injectStyles.call(this, context)
  123. }
  124. // register component module identifier for async chunk inferrence
  125. if (context && context._registeredComponents) {
  126. context._registeredComponents.add(moduleIdentifier)
  127. }
  128. }
  129. // used by ssr in case component is cached and beforeCreate
  130. // never gets called
  131. options._ssrRegister = hook
  132. } else if (injectStyles) {
  133. hook = injectStyles
  134. }
  135. if (hook) {
  136. var functional = options.functional
  137. var existing = functional
  138. ? options.render
  139. : options.beforeCreate
  140. if (!functional) {
  141. // inject component registration as beforeCreate hook
  142. options.beforeCreate = existing
  143. ? [].concat(existing, hook)
  144. : [hook]
  145. } else {
  146. // for template-only hot-reload because in that case the render fn doesn't
  147. // go through the normalizer
  148. options._injectStyles = hook
  149. // register for functioal component in vue file
  150. options.render = function renderWithStyleInjection (h, context) {
  151. hook.call(context)
  152. return existing(h, context)
  153. }
  154. }
  155. }
  156. return {
  157. esModule: esModule,
  158. exports: scriptExports,
  159. options: options
  160. }
  161. }
  162. /***/ }),
  163. /***/ 3:
  164. /***/ (function(module, exports) {
  165. module.exports = require("element-ui/lib/utils/util");
  166. /***/ }),
  167. /***/ 4:
  168. /***/ (function(module, exports) {
  169. module.exports = require("element-ui/lib/mixins/locale");
  170. /***/ }),
  171. /***/ 52:
  172. /***/ (function(module, exports, __webpack_require__) {
  173. module.exports = __webpack_require__(53);
  174. /***/ }),
  175. /***/ 53:
  176. /***/ (function(module, exports, __webpack_require__) {
  177. "use strict";
  178. exports.__esModule = true;
  179. var _pagination = __webpack_require__(54);
  180. var _pagination2 = _interopRequireDefault(_pagination);
  181. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  182. /* istanbul ignore next */
  183. _pagination2.default.install = function (Vue) {
  184. Vue.component(_pagination2.default.name, _pagination2.default);
  185. };
  186. exports.default = _pagination2.default;
  187. /***/ }),
  188. /***/ 54:
  189. /***/ (function(module, exports, __webpack_require__) {
  190. "use strict";
  191. exports.__esModule = true;
  192. var _pager = __webpack_require__(55);
  193. var _pager2 = _interopRequireDefault(_pager);
  194. var _select = __webpack_require__(58);
  195. var _select2 = _interopRequireDefault(_select);
  196. var _option = __webpack_require__(59);
  197. var _option2 = _interopRequireDefault(_option);
  198. var _input = __webpack_require__(6);
  199. var _input2 = _interopRequireDefault(_input);
  200. var _locale = __webpack_require__(4);
  201. var _locale2 = _interopRequireDefault(_locale);
  202. var _util = __webpack_require__(3);
  203. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  204. exports.default = {
  205. name: 'ElPagination',
  206. props: {
  207. pageSize: {
  208. type: Number,
  209. default: 10
  210. },
  211. small: Boolean,
  212. total: Number,
  213. pageCount: Number,
  214. currentPage: {
  215. type: Number,
  216. default: 1
  217. },
  218. layout: {
  219. default: 'prev, pager, next, jumper, ->, total'
  220. },
  221. pageSizes: {
  222. type: Array,
  223. default: function _default() {
  224. return [10, 20, 30, 40, 50, 100];
  225. }
  226. },
  227. popperClass: String,
  228. prevText: String,
  229. nextText: String,
  230. background: Boolean
  231. },
  232. data: function data() {
  233. return {
  234. internalCurrentPage: 1,
  235. internalPageSize: 0
  236. };
  237. },
  238. render: function render(h) {
  239. var template = h(
  240. 'div',
  241. { 'class': ['el-pagination', {
  242. 'is-background': this.background,
  243. 'el-pagination--small': this.small
  244. }] },
  245. []
  246. );
  247. var layout = this.layout || '';
  248. if (!layout) return;
  249. var TEMPLATE_MAP = {
  250. prev: h(
  251. 'prev',
  252. null,
  253. []
  254. ),
  255. jumper: h(
  256. 'jumper',
  257. null,
  258. []
  259. ),
  260. pager: h(
  261. 'pager',
  262. {
  263. attrs: { currentPage: this.internalCurrentPage, pageCount: this.internalPageCount },
  264. on: {
  265. 'change': this.handleCurrentChange
  266. }
  267. },
  268. []
  269. ),
  270. next: h(
  271. 'next',
  272. null,
  273. []
  274. ),
  275. sizes: h(
  276. 'sizes',
  277. {
  278. attrs: { pageSizes: this.pageSizes }
  279. },
  280. []
  281. ),
  282. slot: h(
  283. 'my-slot',
  284. null,
  285. []
  286. ),
  287. total: h(
  288. 'total',
  289. null,
  290. []
  291. )
  292. };
  293. var components = layout.split(',').map(function (item) {
  294. return item.trim();
  295. });
  296. var rightWrapper = h(
  297. 'div',
  298. { 'class': 'el-pagination__rightwrapper' },
  299. []
  300. );
  301. var haveRightWrapper = false;
  302. components.forEach(function (compo) {
  303. if (compo === '->') {
  304. haveRightWrapper = true;
  305. return;
  306. }
  307. if (!haveRightWrapper) {
  308. template.children.push(TEMPLATE_MAP[compo]);
  309. } else {
  310. rightWrapper.children.push(TEMPLATE_MAP[compo]);
  311. }
  312. });
  313. if (haveRightWrapper) {
  314. template.children.unshift(rightWrapper);
  315. }
  316. return template;
  317. },
  318. components: {
  319. MySlot: {
  320. render: function render(h) {
  321. return this.$parent.$slots.default ? this.$parent.$slots.default[0] : '';
  322. }
  323. },
  324. Prev: {
  325. render: function render(h) {
  326. return h(
  327. 'button',
  328. {
  329. attrs: {
  330. type: 'button'
  331. },
  332. 'class': ['btn-prev', { disabled: this.$parent.internalCurrentPage <= 1 }],
  333. on: {
  334. 'click': this.$parent.prev
  335. }
  336. },
  337. [this.$parent.prevText ? h(
  338. 'span',
  339. null,
  340. [this.$parent.prevText]
  341. ) : h(
  342. 'i',
  343. { 'class': 'el-icon el-icon-arrow-left' },
  344. []
  345. )]
  346. );
  347. }
  348. },
  349. Next: {
  350. render: function render(h) {
  351. return h(
  352. 'button',
  353. {
  354. attrs: {
  355. type: 'button'
  356. },
  357. 'class': ['btn-next', { disabled: this.$parent.internalCurrentPage === this.$parent.internalPageCount || this.$parent.internalPageCount === 0 }],
  358. on: {
  359. 'click': this.$parent.next
  360. }
  361. },
  362. [this.$parent.nextText ? h(
  363. 'span',
  364. null,
  365. [this.$parent.nextText]
  366. ) : h(
  367. 'i',
  368. { 'class': 'el-icon el-icon-arrow-right' },
  369. []
  370. )]
  371. );
  372. }
  373. },
  374. Sizes: {
  375. mixins: [_locale2.default],
  376. props: {
  377. pageSizes: Array
  378. },
  379. watch: {
  380. pageSizes: {
  381. immediate: true,
  382. handler: function handler(newVal, oldVal) {
  383. if ((0, _util.valueEquals)(newVal, oldVal)) return;
  384. if (Array.isArray(newVal)) {
  385. this.$parent.internalPageSize = newVal.indexOf(this.$parent.pageSize) > -1 ? this.$parent.pageSize : this.pageSizes[0];
  386. }
  387. }
  388. }
  389. },
  390. render: function render(h) {
  391. var _this = this;
  392. return h(
  393. 'span',
  394. { 'class': 'el-pagination__sizes' },
  395. [h(
  396. 'el-select',
  397. {
  398. attrs: {
  399. value: this.$parent.internalPageSize,
  400. popperClass: (this.$parent.popperClass || '') + ' is-arrow-fixed'
  401. },
  402. on: {
  403. 'input': this.handleChange
  404. }
  405. },
  406. [this.pageSizes.map(function (item) {
  407. return h(
  408. 'el-option',
  409. {
  410. attrs: {
  411. value: item,
  412. label: item + _this.t('el.pagination.pagesize') }
  413. },
  414. []
  415. );
  416. })]
  417. )]
  418. );
  419. },
  420. components: {
  421. ElSelect: _select2.default,
  422. ElOption: _option2.default
  423. },
  424. methods: {
  425. handleChange: function handleChange(val) {
  426. if (val !== this.$parent.internalPageSize) {
  427. this.$parent.internalPageSize = val = parseInt(val, 10);
  428. this.$parent.$emit('size-change', val);
  429. }
  430. }
  431. }
  432. },
  433. Jumper: {
  434. mixins: [_locale2.default],
  435. data: function data() {
  436. return {
  437. oldValue: null
  438. };
  439. },
  440. components: { ElInput: _input2.default },
  441. methods: {
  442. handleFocus: function handleFocus(event) {
  443. this.oldValue = event.target.value;
  444. },
  445. handleBlur: function handleBlur(_ref) {
  446. var target = _ref.target;
  447. this.resetValueIfNeed(target.value);
  448. this.reassignMaxValue(target.value);
  449. },
  450. handleChange: function handleChange(value) {
  451. this.$parent.internalCurrentPage = this.$parent.getValidCurrentPage(value);
  452. this.oldValue = null;
  453. this.resetValueIfNeed(value);
  454. },
  455. resetValueIfNeed: function resetValueIfNeed(value) {
  456. var num = parseInt(value, 10);
  457. if (!isNaN(num)) {
  458. if (num < 1) {
  459. this.$refs.input.$el.querySelector('input').value = 1;
  460. } else {
  461. this.reassignMaxValue(value);
  462. }
  463. }
  464. },
  465. reassignMaxValue: function reassignMaxValue(value) {
  466. if (+value > this.$parent.internalPageCount) {
  467. this.$refs.input.$el.querySelector('input').value = this.$parent.internalPageCount;
  468. }
  469. }
  470. },
  471. render: function render(h) {
  472. return h(
  473. 'span',
  474. { 'class': 'el-pagination__jump' },
  475. [this.t('el.pagination.goto'), h(
  476. 'el-input',
  477. {
  478. 'class': 'el-pagination__editor is-in-pagination',
  479. attrs: { min: 1,
  480. max: this.$parent.internalPageCount,
  481. value: this.$parent.internalCurrentPage,
  482. type: 'number'
  483. },
  484. domProps: {
  485. 'value': this.$parent.internalCurrentPage
  486. },
  487. ref: 'input',
  488. on: {
  489. 'change': this.handleChange,
  490. 'focus': this.handleFocus,
  491. 'blur': this.handleBlur
  492. }
  493. },
  494. []
  495. ), this.t('el.pagination.pageClassifier')]
  496. );
  497. }
  498. },
  499. Total: {
  500. mixins: [_locale2.default],
  501. render: function render(h) {
  502. return typeof this.$parent.total === 'number' ? h(
  503. 'span',
  504. { 'class': 'el-pagination__total' },
  505. [this.t('el.pagination.total', { total: this.$parent.total })]
  506. ) : '';
  507. }
  508. },
  509. Pager: _pager2.default
  510. },
  511. methods: {
  512. handleCurrentChange: function handleCurrentChange(val) {
  513. this.internalCurrentPage = this.getValidCurrentPage(val);
  514. },
  515. prev: function prev() {
  516. var newVal = this.internalCurrentPage - 1;
  517. this.internalCurrentPage = this.getValidCurrentPage(newVal);
  518. },
  519. next: function next() {
  520. var newVal = this.internalCurrentPage + 1;
  521. this.internalCurrentPage = this.getValidCurrentPage(newVal);
  522. },
  523. getValidCurrentPage: function getValidCurrentPage(value) {
  524. value = parseInt(value, 10);
  525. var havePageCount = typeof this.internalPageCount === 'number';
  526. var resetValue = void 0;
  527. if (!havePageCount) {
  528. if (isNaN(value) || value < 1) resetValue = 1;
  529. } else {
  530. if (value < 1) {
  531. resetValue = 1;
  532. } else if (value > this.internalPageCount) {
  533. resetValue = this.internalPageCount;
  534. }
  535. }
  536. if (resetValue === undefined && isNaN(value)) {
  537. resetValue = 1;
  538. } else if (resetValue === 0) {
  539. resetValue = 1;
  540. }
  541. return resetValue === undefined ? value : resetValue;
  542. }
  543. },
  544. computed: {
  545. internalPageCount: function internalPageCount() {
  546. if (typeof this.total === 'number') {
  547. return Math.ceil(this.total / this.internalPageSize);
  548. } else if (typeof this.pageCount === 'number') {
  549. return this.pageCount;
  550. }
  551. return null;
  552. }
  553. },
  554. watch: {
  555. currentPage: {
  556. immediate: true,
  557. handler: function handler(val) {
  558. this.internalCurrentPage = val;
  559. }
  560. },
  561. pageSize: {
  562. immediate: true,
  563. handler: function handler(val) {
  564. this.internalPageSize = val;
  565. }
  566. },
  567. internalCurrentPage: function internalCurrentPage(newVal, oldVal) {
  568. var _this2 = this;
  569. newVal = parseInt(newVal, 10);
  570. /* istanbul ignore if */
  571. if (isNaN(newVal)) {
  572. newVal = oldVal || 1;
  573. } else {
  574. newVal = this.getValidCurrentPage(newVal);
  575. }
  576. if (newVal !== undefined) {
  577. this.$nextTick(function () {
  578. _this2.internalCurrentPage = newVal;
  579. if (oldVal !== newVal) {
  580. _this2.$emit('update:currentPage', newVal);
  581. _this2.$emit('current-change', _this2.internalCurrentPage);
  582. }
  583. });
  584. } else {
  585. this.$emit('update:currentPage', newVal);
  586. this.$emit('current-change', this.internalCurrentPage);
  587. }
  588. },
  589. internalPageCount: function internalPageCount(newVal) {
  590. /* istanbul ignore if */
  591. var oldPage = this.internalCurrentPage;
  592. if (newVal > 0 && oldPage === 0) {
  593. this.internalCurrentPage = 1;
  594. } else if (oldPage > newVal) {
  595. this.internalCurrentPage = newVal === 0 ? 1 : newVal;
  596. }
  597. }
  598. }
  599. };
  600. /***/ }),
  601. /***/ 55:
  602. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  603. "use strict";
  604. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  605. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_pager_vue__ = __webpack_require__(56);
  606. /* harmony import */ 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__);
  607. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_e5b72590_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_pager_vue__ = __webpack_require__(57);
  608. var normalizeComponent = __webpack_require__(0)
  609. /* script */
  610. /* template */
  611. /* template functional */
  612. var __vue_template_functional__ = false
  613. /* styles */
  614. var __vue_styles__ = null
  615. /* scopeId */
  616. var __vue_scopeId__ = null
  617. /* moduleIdentifier (server only) */
  618. var __vue_module_identifier__ = null
  619. var Component = normalizeComponent(
  620. __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_pager_vue___default.a,
  621. __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_e5b72590_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_pager_vue__["a" /* default */],
  622. __vue_template_functional__,
  623. __vue_styles__,
  624. __vue_scopeId__,
  625. __vue_module_identifier__
  626. )
  627. /* harmony default export */ __webpack_exports__["default"] = (Component.exports);
  628. /***/ }),
  629. /***/ 56:
  630. /***/ (function(module, exports, __webpack_require__) {
  631. "use strict";
  632. exports.__esModule = true;
  633. //
  634. //
  635. //
  636. //
  637. //
  638. //
  639. //
  640. //
  641. //
  642. //
  643. //
  644. //
  645. //
  646. //
  647. //
  648. //
  649. //
  650. //
  651. //
  652. //
  653. //
  654. //
  655. //
  656. //
  657. //
  658. //
  659. //
  660. //
  661. //
  662. //
  663. //
  664. exports.default = {
  665. name: 'ElPager',
  666. props: {
  667. currentPage: Number,
  668. pageCount: Number
  669. },
  670. watch: {
  671. showPrevMore: function showPrevMore(val) {
  672. if (!val) this.quickprevIconClass = 'el-icon-more';
  673. },
  674. showNextMore: function showNextMore(val) {
  675. if (!val) this.quicknextIconClass = 'el-icon-more';
  676. }
  677. },
  678. methods: {
  679. onPagerClick: function onPagerClick(event) {
  680. var target = event.target;
  681. if (target.tagName === 'UL') {
  682. return;
  683. }
  684. var newPage = Number(event.target.textContent);
  685. var pageCount = this.pageCount;
  686. var currentPage = this.currentPage;
  687. if (target.className.indexOf('more') !== -1) {
  688. if (target.className.indexOf('quickprev') !== -1) {
  689. newPage = currentPage - 5;
  690. } else if (target.className.indexOf('quicknext') !== -1) {
  691. newPage = currentPage + 5;
  692. }
  693. }
  694. /* istanbul ignore if */
  695. if (!isNaN(newPage)) {
  696. if (newPage < 1) {
  697. newPage = 1;
  698. }
  699. if (newPage > pageCount) {
  700. newPage = pageCount;
  701. }
  702. }
  703. if (newPage !== currentPage) {
  704. this.$emit('change', newPage);
  705. }
  706. }
  707. },
  708. computed: {
  709. pagers: function pagers() {
  710. var pagerCount = 7;
  711. var currentPage = Number(this.currentPage);
  712. var pageCount = Number(this.pageCount);
  713. var showPrevMore = false;
  714. var showNextMore = false;
  715. if (pageCount > pagerCount) {
  716. if (currentPage > pagerCount - 3) {
  717. showPrevMore = true;
  718. }
  719. if (currentPage < pageCount - 3) {
  720. showNextMore = true;
  721. }
  722. }
  723. var array = [];
  724. if (showPrevMore && !showNextMore) {
  725. var startPage = pageCount - (pagerCount - 2);
  726. for (var i = startPage; i < pageCount; i++) {
  727. array.push(i);
  728. }
  729. } else if (!showPrevMore && showNextMore) {
  730. for (var _i = 2; _i < pagerCount; _i++) {
  731. array.push(_i);
  732. }
  733. } else if (showPrevMore && showNextMore) {
  734. var offset = Math.floor(pagerCount / 2) - 1;
  735. for (var _i2 = currentPage - offset; _i2 <= currentPage + offset; _i2++) {
  736. array.push(_i2);
  737. }
  738. } else {
  739. for (var _i3 = 2; _i3 < pageCount; _i3++) {
  740. array.push(_i3);
  741. }
  742. }
  743. this.showPrevMore = showPrevMore;
  744. this.showNextMore = showNextMore;
  745. return array;
  746. }
  747. },
  748. data: function data() {
  749. return {
  750. current: null,
  751. showPrevMore: false,
  752. showNextMore: false,
  753. quicknextIconClass: 'el-icon-more',
  754. quickprevIconClass: 'el-icon-more'
  755. };
  756. }
  757. };
  758. /***/ }),
  759. /***/ 57:
  760. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  761. "use strict";
  762. 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 }},[_vm._v("1")]):_vm._e(),(_vm.showPrevMore)?_c('li',{staticClass:"el-icon more btn-quickprev",class:[_vm.quickprevIconClass],on:{"mouseenter":function($event){_vm.quickprevIconClass = 'el-icon-d-arrow-left'},"mouseleave":function($event){_vm.quickprevIconClass = 'el-icon-more'}}}):_vm._e(),_vm._l((_vm.pagers),function(pager){return _c('li',{staticClass:"number",class:{ active: _vm.currentPage === pager }},[_vm._v(_vm._s(pager))])}),(_vm.showNextMore)?_c('li',{staticClass:"el-icon more btn-quicknext",class:[_vm.quicknextIconClass],on:{"mouseenter":function($event){_vm.quicknextIconClass = 'el-icon-d-arrow-right'},"mouseleave":function($event){_vm.quicknextIconClass = 'el-icon-more'}}}):_vm._e(),(_vm.pageCount > 1)?_c('li',{staticClass:"number",class:{ active: _vm.currentPage === _vm.pageCount }},[_vm._v(_vm._s(_vm.pageCount))]):_vm._e()],2)}
  763. var staticRenderFns = []
  764. var esExports = { render: render, staticRenderFns: staticRenderFns }
  765. /* harmony default export */ __webpack_exports__["a"] = (esExports);
  766. /***/ }),
  767. /***/ 58:
  768. /***/ (function(module, exports) {
  769. module.exports = require("element-ui/lib/select");
  770. /***/ }),
  771. /***/ 59:
  772. /***/ (function(module, exports) {
  773. module.exports = require("element-ui/lib/option");
  774. /***/ }),
  775. /***/ 6:
  776. /***/ (function(module, exports) {
  777. module.exports = require("element-ui/lib/input");
  778. /***/ })
  779. /******/ });