MUI 结合layui实现分页

mui自带有分页,在ui上我还是认为layui的友好点。

第三方插件:

template-web.js-----------------前端数据绑定

layui.js、layui.css--------------layui分页控件(可以去官网下载)

html代码:

  1 <!doctype html>
  2 <html>
  3     <head>
  4         <meta charset="UTF-8">
  5         <title></title>
  6         <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7         <link href="../css/mui.min.css" rel="stylesheet" />
  8         <link rel="stylesheet" href="../layui/css/layui.css" />
  9     </head>
 10     <body>
 11         
 12             <div class="ui-page-login">
 13                 <span>分页示例</span>
 14                 <label id="pagination_msg"></label>
 15                 <input type="button" id="btnPagination" class="layui-btn layui-btn-normal layui-btn-mini" value="获取分页数据">
 16                 <blockquote>
 17                     <div id="DataContent"></div>
 18                     <script id="DataList" type="text/html">
 19                     <table class="layui-table">
 20                         <thead>
 21                             <tr>
 22                                 <th>
 23                                     <div class="layui-unselect header layui-form-checkbox headercheckbox" lay-skin="primary">
 24                                         <i class="layui-icon">&#xe605;</i>
 25                                     </div>
 26                                 </th>
 27                                 <th>审核人员姓名</th>
 28                                 <th>联系人</th>
 29                                 <th>支付方式</th>
 30                                 <th>状态</th>
 31                                 <th>操作</th>
 32                             </tr>
 33                         </thead>
 34                         <tbody>                            
 35                                 <%for (var i =0;i<list.length;i++){%>
 36                                 <tr>
 37                                     <td style="text-align:center">
 38                                         <!--<input type="checkbox" data-id="{{list[i].LogId}}" />-->
 39                                         <div class="layui-unselect layui-form-checkbox bodycheckbox" lay-skin="primary" data-id="{{list[i].LogId}}">
 40                                             <i class="layui-icon">&#xe605;</i>
 41                                         </div>
 42                                     </td>
 43                                     <td id="maintenance_name" style="text-align:left">{{list[i].AuditName}}</td>
 44                                     <td id="sub_name" style="text-align:left">{{list[i].LinkMan}}</td>
 45                                     <td id="remark" style="text-align:left">{{list[i].Payment}}</td>
 46                                     <td id="validName" style="text-align:left">
 47                                         {{if list[i].Status==1}}
 48                                         <span class="layui-btn layui-btn-normal layui-btn-mini">已启用</span> {{else}}
 49                                         <span class="layui-btn layui-btn-disabled">禁用</span> {{/if}}
 50                                     </td>
 51                                     <td class="td-manage">
 52                                         <a onclick="member_stop(this,'10001')" href="javascript:;" title="启用">
 53                                             <i class="layui-icon">&#xe601;</i>
 54                                         </a>
 55                                         <a title="编辑" onclick="x_admin_show('编辑','member-edit.html',600,400)" href="javascript:;">
 56                                             <i class="layui-icon">&#xe642;</i>
 57                                         </a>
 58                                         <a onclick="x_admin_show('修改密码','member-password.html',600,400)" title="修改密码" href="javascript:;">
 59                                             <i class="layui-icon">&#xe631;</i>
 60                                         </a>
 61                                         <a title="删除" onclick="member_del(this,'要删除的id')" href="javascript:;">
 62                                             <i class="layui-icon">&#xe640;</i>
 63                                         </a>
 64                                     </td>
 65                                 </tr>
 66                             <%}%>                            
 67                         </tbody>
 68                     </table>
 69                     
 70                     </script>
 71                     <!--分页-->
 72                     <fieldset class="layui-elem-field layui-field-title" style="border: 0;">
 73                         <div id="Pagination"></div>
 74                     </fieldset>
 75                     <table class="layui-hide" id="test"></table>
 76                 </blockquote>
 77 
 78             </div>            
 79         </div>
 80     </body>
 81 
 82 </html>
 83 <script src="../js/mui.min.js"></script>
 84 <script src="../js/template-web.js"></script>
 85 <script src="../layui/layui.js"></script>
 86 <script src="../js/LayerPagination.js"></script>
 87 <script type="text/javascript">
 88     mui.init();
 89     mui.plusReady(function() {        
 90         //分页测试
 91         mui('.ui-page-login').on('tap', '#btnPagination', function() {
 92             //调用分页公用方法
 93             var pageSize = 5;
 94             var tableName = "财务单据";
 95             var isTemplate = "true";
 96             var rquestData = JSON.stringify({
 97                 pageIndex: 1,
 98                 pageSize: pageSize,
 99                 where: ""
100             });
101             var paginationUrl = reqRootUrl + "/api/FinanceApi/ApiCloseing";
102             funPagination(_ticket, paginationUrl, "post", rquestData, function(rdata) {
103                 if(typeof(rdata) != "undefined") {
104                     if(typeof(rdata.code) != "undefined") {
105                         if(rdata.code == -1)
106                             mui("#pagination_msg")[0].innerHTML = rdata.message; 
107                         else
108                             mui("#pagination_msg")[0].innerHTML = "操作失败";
109                     } else {
110                         //绑定数据
111                         var data = {
112                             title: tableName,
113                             isTemplate: isTemplate,
114                             list: rdata.Data
115                         };
116                         var html = template('DataList', data);
117                         mui("#DataContent")[0].innerHTML = html;
118 
119                         //绑定分页
120                         layui.use('laypage', function() {
121                             var laypage = layui.laypage;
122                             laypage.render({
123                                 elem: 'Pagination',
124                                 count: rdata.Total,
125                                 limit: pageSize,
126                                 first: "首页",
127                                 prev: "<em>←</em>",
128                                 next: "<em>→</em>",
129                                 last: "尾页",
130                                 hash: 'fenye',
131                                 jump: function(obj) {
132                                     var rquestData = JSON.stringify({
133                                         pageIndex: obj.curr,
134                                         pageSize: pageSize,
135                                         where: ""
136                                     });
137                                     funPagination(_ticket, paginationUrl, "post", rquestData, function(rdata) {
138                                         data.title = tableName;
139                                         data.isTemplate = isTemplate;
140                                         data.list = rdata.Data;
141                                         var html = template('DataList', data);
142                                         mui("#DataContent")[0].innerHTML = html;
143                                     });
144                                 }
145                             });
146                         });
147 
148                     }
149                 } else {
150                     mui.toast("操作失败");
151                 }
152             });
153 
154         });
155 
156     });
157     //checkbox特性
158     function setCheckBox(obj) {
159         if(mui(obj).hasClass("layui-form-checked"))
160             mui(obj).removeClass("layui-form-checked");
161         else
162             mui(obj).addClass("layui-form-checked");
163     }
164 </script>

 

LayerPagination.js

 1 function funPagination(_ticket, apiurl, methodtype, rqueatdata, callback) {
 2     /// <summary>
 3     /// MUI AJAX通用函数
 4     /// </summary>
 5     /// <param name="_ticket" type="string">接口请求票据</param>
 6     /// <param name="apiurl" type="string">接口请求地址</param>
 7     /// <param name="methodtype" type="post/get">接口请求方式</param>
 8     /// <param name="rqueatdata" type="json">接口请求数据</param>
 9     /// <param name="theadlist" type="array">表头字段</param>    
10     /// <param name="callback" type="function">回调函数</param>
11     mui.ajax({
12         url: apiurl,
13         type: methodtype,
14         data: rqueatdata,
15         headers: {
16             'Content-Type': 'application/json',
17             "Authorization": "BasicAuth " + _ticket
18         },
19         dataType: "json",
20         timeout: 30000, //超时时间设置为10秒;
21         success: function(rdata) {
22             if(typeof(rdata) != "undefined") {
23                 callback(rdata);
24             } else {
25                 callback("无操作数据");
26             }
27         },
28         error: function(xhr, type, errorThrown) {
29             var _error = "";
30             var robj = {
31                 code: 0,
32                 message: ""
33             };
34             switch(type) {
35                 case "timeout":
36                     _error = "服务器响应超时";
37                     break;
38                 default:
39                     _error = "异常信息:" + xhr.responseText;
40                     break;
41             }
42             robj.code = -1;
43             robj.message = _error;
44             //callback("layerPaginationErrorMessage:" + _error); //mui.toast(_error);
45             callback(robj);
46         }
47     });
48 }
View Code

template-web.js(也可以去官网下载)

1 /*! art-template@4.13.2 for browser | https://github.com/aui/art-template */
2 !function (e, t) { "object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define([], t) : "object" == typeof exports ? exports.template = t() : e.template = t() }("undefined" != typeof self ? self : this, function () {
3     return function (e) { function t(r) { if (n[r]) return n[r].exports; var i = n[r] = { i: r, l: !1, exports: {} }; return e[r].call(i.exports, i, i.exports, t), i.l = !0, i.exports } var n = {}; return t.m = e, t.c = n, t.d = function (e, n, r) { t.o(e, n) || Object.defineProperty(e, n, { configurable: !1, enumerable: !0, get: r }) }, t.n = function (e) { var n = e && e.__esModule ? function () { return e["default"] } : function () { return e }; return t.d(n, "a", n), n }, t.o = function (e, t) { return Object.prototype.hasOwnProperty.call(e, t) }, t.p = "", t(t.s = 4) }([function (e, t, n) { "use strict"; var r = n(6), i = n(2), o = n(22), s = function (e, t) { t.onerror(e, t); var n = function () { return "{Template Error}" }; return n.mappings = [], n.sourcesContent = [], n }, a = function u(e) { var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; "string" != typeof e ? t = e : t.source = e, t = i.$extend(t), e = t.source, !0 === t.debug && (t.cache = !1, t.minimize = !1, t.compileDebug = !0), t.compileDebug && (t.minimize = !1), t.filename && (t.filename = t.resolveFilename(t.filename, t)); var n = t.filename, a = t.cache, c = t.caches; if (a && n) { var l = c.get(n); if (l) return l } if (!e) try { e = t.loader(n, t), t.source = e } catch (m) { var f = new o({ name: "CompileError", path: n, message: "template not found: " + m.message, stack: m.stack }); if (t.bail) throw f; return s(f, t) } var p = void 0, h = new r(t); try { p = h.build() } catch (f) { if (f = new o(f), t.bail) throw f; return s(f, t) } var d = function (e, n) { try { return p(e, n) } catch (f) { if (!t.compileDebug) return t.cache = !1, t.compileDebug = !0, u(t)(e, n); if (f = new o(f), t.bail) throw f; return s(f, t)() } }; return d.mappings = p.mappings, d.sourcesContent = p.sourcesContent, d.toString = function () { return p.toString() }, a && n && c.set(n, d), d }; a.Compiler = r, e.exports = a }, function (e, t) { Object.defineProperty(t, "__esModule", { value: !0 }), t["default"] = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyu]{1,5}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g, t.matchToToken = function (e) { var t = { type: "invalid", value: e[0] }; return e[1] ? (t.type = "string", t.closed = !(!e[3] && !e[4])) : e[5] ? t.type = "comment" : e[6] ? (t.type = "comment", t.closed = !!e[7]) : e[8] ? t.type = "regex" : e[9] ? t.type = "number" : e[10] ? t.type = "name" : e[11] ? t.type = "punctuator" : e[12] && (t.type = "whitespace"), t } }, function (e, t, n) { "use strict"; function r() { this.$extend = function (e) { return e = e || {}, o(e, e instanceof r ? e : this) } } var i = n(10), o = n(12), s = n(13), a = n(14), u = n(15), c = n(16), l = n(17), f = n(18), p = n(19), h = n(21), d = "undefined" == typeof window, m = { source: null, filename: null, rules: [f, l], escape: !0, debug: !!d && "production" !== process.env.NODE_ENV, bail: !0, cache: !0, minimize: !0, compileDebug: !1, resolveFilename: h, include: s, htmlMinifier: p, htmlMinifierOptions: { collapseWhitespace: !0, minifyCSS: !0, minifyJS: !0, ignoreCustomFragments: [] }, onerror: a, loader: c, caches: u, root: "/", extname: ".art", ignore: [], imports: i }; r.prototype = m, e.exports = new r }, function (e, t) { }, function (e, t, n) { "use strict"; var r = n(5), i = n(0), o = n(23), s = function (e, t) { return t instanceof Object ? r({ filename: e }, t) : i({ filename: e, source: t }) }; s.render = r, s.compile = i, s.defaults = o, e.exports = s }, function (e, t, n) { "use strict"; var r = n(0), i = function (e, t, n) { return r(e, n)(t) }; e.exports = i }, function (e, t, n) { "use strict"; function r(e, t, n) { return t in e ? Object.defineProperty(e, t, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = n, e } function i(e) { if (Array.isArray(e)) { for (var t = 0, n = Array(e.length); t < e.length; t++)n[t] = e[t]; return n } return Array.from(e) } function o(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") } var s = function () { function e(e, t) { for (var n = 0; n < t.length; n++) { var r = t[n]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) } } return function (t, n, r) { return n && e(t.prototype, n), r && e(t, r), t } }(), a = n(7), u = n(9), c = "$data", l = "$imports", f = "print", p = "include", h = "extend", d = "block", m = "$$out", v = "$$line", g = "$$blocks", y = "$$slice", b = "$$from", w = "$$options", x = function (e, t) { return Object.hasOwnProperty.call(e, t) }, k = JSON.stringify, E = function () { function e(t) { var n, s, a = this; o(this, e); var x = t.source, k = t.minimize, E = t.htmlMinifier; if (this.options = t, this.stacks = [], this.context = [], this.scripts = [], this.CONTEXT_MAP = {}, this.ignore = [c, l, w].concat(i(t.ignore)), this.internal = (n = {}, r(n, m, "''"), r(n, v, "[0,0]"), r(n, g, "arguments[1]||{}"), r(n, b, "null"), r(n, f, "function(){var s=''.concat.apply('',arguments);" + m + "+=s;return s}"), r(n, p, "function(src,data){var s=" + w + ".include(src,data||" + c + ",arguments[2]||" + g + "," + w + ");" + m + "+=s;return s}"), r(n, h, "function(from){" + b + "=from}"), r(n, y, "function(c,p,s){p=" + m + ";" + m + "='';c();s=" + m + ";" + m + "=p+s;return s}"), r(n, d, "function(){var a=arguments,s;if(typeof a[0]==='function'){return " + y + "(a[0])}else if(" + b + "){if(!" + g + "[a[0]]){" + g + "[a[0]]=" + y + "(a[1])}else{" + m + "+=" + g + "[a[0]]}}else{s=" + g + "[a[0]];if(typeof s==='string'){" + m + "+=s}else{s=" + y + "(a[1])}return s}}"), n), this.dependencies = (s = {}, r(s, f, [m]), r(s, p, [m, w, c, g]), r(s, h, [b, p]), r(s, d, [y, b, m, g]), s), this.importContext(m), t.compileDebug && this.importContext(v), k) try { x = E(x, t) } catch (T) { } this.source = x, this.getTplTokens(x, t.rules, this).forEach(function (e) { e.type === u.TYPE_STRING ? a.parseString(e) : a.parseExpression(e) }) } return s(e, [{ key: "getTplTokens", value: function () { return u.apply(undefined, arguments) } }, { key: "getEsTokens", value: function (e) { return a(e) } }, { key: "getVariables", value: function (e) { var t = !1; return e.filter(function (e) { return "whitespace" !== e.type && "comment" !== e.type }).filter(function (e) { return "name" === e.type && !t || (t = "punctuator" === e.type && "." === e.value, !1) }).map(function (e) { return e.value }) } }, { key: "importContext", value: function (e) { var t = this, n = "", r = this.internal, i = this.dependencies, o = this.ignore, s = this.context, a = this.options, u = a.imports, f = this.CONTEXT_MAP; x(f, e) || -1 !== o.indexOf(e) || (x(r, e) ? (n = r[e], x(i, e) && i[e].forEach(function (e) { return t.importContext(e) })) : n = "$escape" === e || "$each" === e || x(u, e) ? l + "." + e : c + "." + e, f[e] = n, s.push({ name: e, value: n })) } }, { key: "parseString", value: function (e) { var t = e.value; if (t) { var n = m + "+=" + k(t); this.scripts.push({ source: t, tplToken: e, code: n }) } } }, { key: "parseExpression", value: function (e) { var t = this, n = e.value, r = e.script, i = r.output, o = this.options.escape, s = r.code; i && (s = !1 === o || i === u.TYPE_RAW ? m + "+=" + r.code : m + "+=$escape(" + r.code + ")"); var a = this.getEsTokens(s); this.getVariables(a).forEach(function (e) { return t.importContext(e) }), this.scripts.push({ source: n, tplToken: e, code: s }) } }, { key: "checkExpression", value: function (e) { for (var t = [[/^\s*}[\w\W]*?{?[\s;]*$/, ""], [/(^[\w\W]*?\([\w\W]*?(?:=>|\([\w\W]*?\))\s*{[\s;]*$)/, "$1})"], [/(^[\w\W]*?\([\w\W]*?\)\s*{[\s;]*$)/, "$1}"]], n = 0; n < t.length;) { if (t[n][0].test(e)) { var r; e = (r = e).replace.apply(r, i(t[n])); break } n++ } try { return new Function(e), !0 } catch (o) { return !1 } } }, { key: "build", value: function () { var e = this.options, t = this.context, n = this.scripts, r = this.stacks, i = this.source, o = e.filename, s = e.imports, a = [], f = x(this.CONTEXT_MAP, h), d = 0, y = function (e, t) { var n = t.line, i = t.start, o = { generated: { line: r.length + d + 1, column: 1 }, original: { line: n + 1, column: i + 1 } }; return d += e.split(/\n/).length - 1, o }, E = function (e) { return e.replace(/^[\t ]+|[\t ]$/g, "") }; r.push("function(" + c + "){"), r.push("'use strict'"), r.push(c + "=" + c + "||{}"), r.push("var " + t.map(function (e) { return e.name + "=" + e.value }).join(",")), e.compileDebug ? (r.push("try{"), n.forEach(function (e) { e.tplToken.type === u.TYPE_EXPRESSION && r.push(v + "=[" + [e.tplToken.line, e.tplToken.start].join(",") + "]"), a.push(y(e.code, e.tplToken)), r.push(E(e.code)) }), r.push("}catch(error){"), r.push("throw {" + ["name:'RuntimeError'", "path:" + k(o), "message:error.message", "line:" + v + "[0]+1", "column:" + v + "[1]+1", "source:" + k(i), "stack:error.stack"].join(",") + "}"), r.push("}")) : n.forEach(function (e) { a.push(y(e.code, e.tplToken)), r.push(E(e.code)) }), f && (r.push(m + "=''"), r.push(p + "(" + b + "," + c + "," + g + ")")), r.push("return " + m), r.push("}"); var T = r.join("\n"); try { var O = new Function(l, w, "return " + T)(s, e); return O.mappings = a, O.sourcesContent = [i], O } catch (P) { for (var $ = 0, j = 0, _ = 0, S = void 0; $ < n.length;) { var C = n[$]; if (!this.checkExpression(C.code)) { j = C.tplToken.line, _ = C.tplToken.start, S = C.code; break } $++ } throw { name: "CompileError", path: o, message: P.message, line: j + 1, column: _ + 1, source: i, generated: S, stack: P.stack } } } }]), e }(); E.CONSTS = { DATA: c, IMPORTS: l, PRINT: f, INCLUDE: p, EXTEND: h, BLOCK: d, OPTIONS: w, OUT: m, LINE: v, BLOCKS: g, SLICE: y, FROM: b, ESCAPE: "$escape", EACH: "$each" }, e.exports = E }, function (e, t, n) { "use strict"; var r = n(8), i = n(1)["default"], o = n(1).matchToToken, s = function (e) { return e.match(i).map(function (e) { return i.lastIndex = 0, o(i.exec(e)) }).map(function (e) { return "name" === e.type && r(e.value) && (e.type = "keyword"), e }) }; e.exports = s }, function (e, t, n) { "use strict"; var r = { "abstract": !0, await: !0, "boolean": !0, "break": !0, "byte": !0, "case": !0, "catch": !0, "char": !0, "class": !0, "const": !0, "continue": !0, "debugger": !0, "default": !0, "delete": !0, "do": !0, "double": !0, "else": !0, "enum": !0, "export": !0, "extends": !0, "false": !0, "final": !0, "finally": !0, "float": !0, "for": !0, "function": !0, "goto": !0, "if": !0, "implements": !0, "import": !0, "in": !0, "instanceof": !0, "int": !0, "interface": !0, "let": !0, "long": !0, "native": !0, "new": !0, "null": !0, "package": !0, "private": !0, "protected": !0, "public": !0, "return": !0, "short": !0, "static": !0, "super": !0, "switch": !0, "synchronized": !0, "this": !0, "throw": !0, "transient": !0, "true": !0, "try": !0, "typeof": !0, "var": !0, "void": !0, "volatile": !0, "while": !0, "with": !0, "yield": !0 }; e.exports = function (e) { return r.hasOwnProperty(e) } }, function (e, t, n) { "use strict"; function r(e) { var t = new String(e.value); return t.line = e.line, t.start = e.start, t.end = e.end, t } function i(e, t, n) { this.type = e, this.value = t, this.script = null, n ? (this.line = n.line + n.value.split(/\n/).length - 1, this.line === n.line ? this.start = n.end : this.start = n.value.length - n.value.lastIndexOf("\n") - 1) : (this.line = 0, this.start = 0), this.end = this.start + this.value.length } var o = function (e, t) { for (var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, o = [new i("string", e)], s = 0; s < t.length; s++)for (var a = t[s], u = a.test.ignoreCase ? "ig" : "g", c = new RegExp(a.test.source, u), l = 0; l < o.length; l++) { var f = o[l], p = o[l - 1]; if ("string" === f.type) { for (var h = void 0, d = 0, m = [], v = f.value; null !== (h = c.exec(v));)h.index > d && (p = new i("string", v.slice(d, h.index), p), m.push(p)), p = new i("expression", h[0], p), h[0] = r(p), p.script = a.use.apply(n, h), m.push(p), d = h.index + h[0].length; d < v.length && (p = new i("string", v.slice(d), p), m.push(p)), o.splice.apply(o, [l, 1].concat(m)), l += m.length - 1 } } return o }; o.TYPE_STRING = "string", o.TYPE_EXPRESSION = "expression", o.TYPE_RAW = "raw", o.TYPE_ESCAPE = "escape", e.exports = o }, function (e, t, n) {
4         "use strict"; (function (t) {
5             function n(e) { return "string" != typeof e && (e = e === undefined || null === e ? "" : "function" == typeof e ? n(e.call(e)) : JSON.stringify(e)), e } function r(e) { var t = "" + e, n = s.exec(t); if (!n) return e; var r = "", i = void 0, o = void 0, a = void 0; for (i = n.index, o = 0; i < t.length; i++) { switch (t.charCodeAt(i)) { case 34: a = "&#34;"; break; case 38: a = "&#38;"; break; case 39: a = "&#39;"; break; case 60: a = "&#60;"; break; case 62: a = "&#62;"; break; default: continue }o !== i && (r += t.substring(o, i)), o = i + 1, r += a } return o !== i ? r + t.substring(o, i) : r }/*! art-template@runtime | https://github.com/aui/art-template */
6             var i = "undefined" != typeof self ? self : "undefined" != typeof window ? window : void 0 !== t ? t : {}, o = Object.create(i), s = /["&'<>]/; o.$escape = function (e) { return r(n(e)) }, o.$each = function (e, t) { if (Array.isArray(e)) for (var n = 0, r = e.length; n < r; n++)t(e[n], n); else for (var i in e) t(e[i], i) }, e.exports = o
7         }).call(t, n(11))
8     }, function (e, t) { var n; n = function () { return this }(); try { n = n || Function("return this")() || (0, eval)("this") } catch (r) { "object" == typeof window && (n = window) } e.exports = n }, function (e, t, n) { "use strict"; var r = Object.prototype.toString, i = function (e) { return null === e ? "Null" : r.call(e).slice(8, -1) }, o = function s(e, t) { var n = void 0, r = i(e); if ("Object" === r ? n = Object.create(t || {}) : "Array" === r && (n = [].concat(t || [])), n) { for (var o in e) Object.hasOwnProperty.call(e, o) && (n[o] = s(e[o], n[o])); return n } return e }; e.exports = o }, function (e, t, n) { "use strict"; var r = function (e, t, r, i) { var o = n(0); return i = i.$extend({ filename: i.resolveFilename(e, i), bail: !0, source: null }), o(i)(t, r) }; e.exports = r }, function (e, t, n) { "use strict"; var r = function (e) { console.error(e.name, e.message) }; e.exports = r }, function (e, t, n) { "use strict"; var r = { __data: Object.create(null), set: function (e, t) { this.__data[e] = t }, get: function (e) { return this.__data[e] }, reset: function () { this.__data = {} } }; e.exports = r }, function (e, t, n) { "use strict"; var r = "undefined" == typeof window, i = function (e) { if (r) { return n(3).readFileSync(e, "utf8") } var t = document.getElementById(e); return t.value || t.innerHTML }; e.exports = i }, function (e, t, n) { "use strict"; var r = { test: /{{([@#]?)[ \t]*(\/?)([\w\W]*?)[ \t]*}}/, use: function (e, t, n, i) { var o = this, s = o.options, a = o.getEsTokens(i), u = a.map(function (e) { return e.value }), c = {}, l = void 0, f = !!t && "raw", p = n + u.shift(), h = function (t, n) { console.warn((s.filename || "anonymous") + ":" + (e.line + 1) + ":" + (e.start + 1) + "\nTemplate upgrade: {{" + t + "}} -> {{" + n + "}}") }; switch ("#" === t && h("#value", "@value"), p) { case "set": i = "var " + u.join("").trim(); break; case "if": i = "if(" + u.join("").trim() + "){"; break; case "else": var d = u.indexOf("if"); ~d ? (u.splice(0, d + 1), i = "}else if(" + u.join("").trim() + "){") : i = "}else{"; break; case "/if": i = "}"; break; case "each": l = r._split(a), l.shift(), "as" === l[1] && (h("each object as value index", "each object value index"), l.splice(1, 1)); i = "$each(" + (l[0] || "$data") + ",function(" + (l[1] || "$value") + "," + (l[2] || "$index") + "){"; break; case "/each": i = "})"; break; case "block": l = r._split(a), l.shift(), i = "block(" + l.join(",").trim() + ",function(){"; break; case "/block": i = "})"; break; case "echo": p = "print", h("echo value", "value"); case "print": case "include": case "extend": if (0 !== u.join("").trim().indexOf("(")) { l = r._split(a), l.shift(), i = p + "(" + l.join(",") + ")"; break } default: if (~u.indexOf("|")) { var m = a.reduce(function (e, t) { var n = t.value, r = t.type; return "|" === n ? e.push([]) : "whitespace" !== r && "comment" !== r && (e.length || e.push([]), ":" === n && 1 === e[e.length - 1].length ? h("value | filter: argv", "value | filter argv") : e[e.length - 1].push(t)), e }, []).map(function (e) { return r._split(e) }); i = m.reduce(function (e, t) { var n = t.shift(); return t.unshift(e), "$imports." + n + "(" + t.join(",") + ")" }, m.shift().join(" ").trim()) } f = f || "escape" }return c.code = i, c.output = f, c }, _split: function (e) { e = e.filter(function (e) { var t = e.type; return "whitespace" !== t && "comment" !== t }); for (var t = 0, n = e.shift(), r = /\]|\)/, i = [[n]]; t < e.length;) { var o = e[t]; "punctuator" === o.type || "punctuator" === n.type && !r.test(n.value) ? i[i.length - 1].push(o) : i.push([o]), n = o, t++ } return i.map(function (e) { return e.map(function (e) { return e.value }).join("") }) } }; e.exports = r }, function (e, t, n) { "use strict"; var r = { test: /<%(#?)((?:==|=#|[=-])?)[ \t]*([\w\W]*?)[ \t]*(-?)%>/, use: function (e, t, n, r) { return n = { "-": "raw", "=": "escape", "": !1, "==": "raw", "=#": "raw" }[n], t && (r = "/*" + r + "*/", n = !1), { code: r, output: n } } }; e.exports = r }, function (e, t, n) { "use strict"; function r(e) { if (Array.isArray(e)) { for (var t = 0, n = Array(e.length); t < e.length; t++)n[t] = e[t]; return n } return Array.from(e) } var i = "undefined" == typeof window, o = function (e, t) { if (i) { var o, s = n(20).minify, a = t.htmlMinifierOptions, u = t.rules.map(function (e) { return e.test }); (o = a.ignoreCustomFragments).push.apply(o, r(u)), e = s(e, a) } return e }; e.exports = o }, function (e, t) { !function (e) { e.noop = function () { } }("object" == typeof e && "object" == typeof e.exports ? e.exports : window) }, function (e, t, n) { "use strict"; var r = "undefined" == typeof window, i = /^\.+\//, o = function (e, t) { if (r) { var o = n(3), s = t.root, a = t.extname; if (i.test(e)) { var u = t.filename, c = !u || e === u, l = c ? s : o.dirname(u); e = o.resolve(l, e) } else e = o.resolve(s, e); o.extname(e) || (e += a) } return e }; e.exports = o }, function (e, t, n) { "use strict"; function r(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") } function i(e, t) { if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !t || "object" != typeof t && "function" != typeof t ? e : t } function o(e, t) { if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + typeof t); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t) } function s(e) { var t = e.name, n = e.source, r = e.path, i = e.line, o = e.column, s = e.generated, a = e.message; if (!n) return a; var u = n.split(/\n/), c = Math.max(i - 3, 0), l = Math.min(u.length, i + 3), f = u.slice(c, l).map(function (e, t) { var n = t + c + 1; return (n === i ? " >> " : "    ") + n + "| " + e }).join("\n"); return (r || "anonymous") + ":" + i + ":" + o + "\n" + f + "\n\n" + t + ": " + a + (s ? "\n   generated: " + s : "") } var a = function (e) { function t(e) { r(this, t); var n = i(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e.message)); return n.name = "TemplateError", n.message = s(e), Error.captureStackTrace && Error.captureStackTrace(n, n.constructor), n } return o(t, e), t }(Error); e.exports = a }, function (e, t, n) { "use strict"; e.exports = n(2) }])
9 });
View Code

 

posted @ 2018-12-04 17:06  CHNMurphy  阅读(976)  评论(0编辑  收藏  举报