var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Page = function () { function Page() { _classCallCheck(this, Page); } _createClass(Page, [{ key: 'init', value: function init(offset, limit, num, fun) { var html = ''; if (num == 0 || num <= limit) { return ''; } var page = Math.floor(offset / limit) + 1; var total = Math.ceil(num / limit); html = '
\u9996\u9875'; if (page > 1) { html += '\u4E0A\u4E00\u9875'; } var mintotal = page - 3 > 1 ? page - 3 : 1; var maxtotal = page + 3 > total ? total : page + 3; for (var i = mintotal; i <= maxtotal; i++) { if (i == page) { html += '' + i + ''; } else { html += '' + i + ''; } } if (page < total) { html += '\u4E0B\u4E00\u9875'; } html += '\u672B\u9875
'; $("#page").html(''); $("#page").html(html); // return html } }]); return Page; }();