publish
This commit is contained in:
parent
c0f555adcf
commit
fba6ab7cd2
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "layui",
|
||||
"main": "dist/layui.js",
|
||||
"version": "2.5.5",
|
||||
"version": "2.5.6",
|
||||
"homepage": "https://github.com/sentsin/layui",
|
||||
"authors": [
|
||||
"sentsin <xu@sentsin.com>"
|
||||
|
4
dist/css/layui.css
vendored
4
dist/css/layui.css
vendored
File diff suppressed because one or more lines are too long
2
dist/css/layui.mobile.css
vendored
2
dist/css/layui.mobile.css
vendored
File diff suppressed because one or more lines are too long
2
dist/css/modules/code.css
vendored
2
dist/css/modules/code.css
vendored
@ -1,2 +1,2 @@
|
||||
/** layui-v2.5.5 MIT License By https://www.layui.com */
|
||||
/** layui-v2.5.6 MIT License By https://www.layui.com */
|
||||
html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #e2e2e2;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:32px;line-height:32px;border-bottom:1px solid #e2e2e2}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 5px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none}
|
2
dist/css/modules/laydate/default/laydate.css
vendored
2
dist/css/modules/laydate/default/laydate.css
vendored
File diff suppressed because one or more lines are too long
2
dist/css/modules/layer/default/layer.css
vendored
2
dist/css/modules/layer/default/layer.css
vendored
File diff suppressed because one or more lines are too long
BIN
dist/font/iconfont.eot
vendored
BIN
dist/font/iconfont.eot
vendored
Binary file not shown.
73
dist/font/iconfont.svg
vendored
73
dist/font/iconfont.svg
vendored
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 277 KiB After Width: | Height: | Size: 299 KiB |
BIN
dist/font/iconfont.ttf
vendored
BIN
dist/font/iconfont.ttf
vendored
Binary file not shown.
BIN
dist/font/iconfont.woff
vendored
BIN
dist/font/iconfont.woff
vendored
Binary file not shown.
BIN
dist/font/iconfont.woff2
vendored
BIN
dist/font/iconfont.woff2
vendored
Binary file not shown.
2
dist/lay/modules/carousel.js
vendored
2
dist/lay/modules/carousel.js
vendored
@ -1,2 +1,2 @@
|
||||
/** layui-v2.5.5 MIT License By https://www.layui.com */
|
||||
/** layui-v2.5.6 MIT License By https://www.layui.com */
|
||||
;layui.define("jquery",function(e){"use strict";var i=layui.$,n=(layui.hint(),layui.device(),{config:{},set:function(e){var n=this;return n.config=i.extend({},n.config,e),n},on:function(e,i){return layui.onevent.call(this,t,e,i)}}),t="carousel",a="layui-this",l=">*[carousel-item]>*",o="layui-carousel-left",r="layui-carousel-right",d="layui-carousel-prev",s="layui-carousel-next",u="layui-carousel-arrow",c="layui-carousel-ind",m=function(e){var t=this;t.config=i.extend({},t.config,n.config,e),t.render()};m.prototype.config={width:"600px",height:"280px",full:!1,arrow:"hover",indicator:"inside",autoplay:!0,interval:3e3,anim:"",trigger:"click",index:0},m.prototype.render=function(){var e=this,n=e.config;n.elem=i(n.elem),n.elem[0]&&(e.elemItem=n.elem.find(l),n.index<0&&(n.index=0),n.index>=e.elemItem.length&&(n.index=e.elemItem.length-1),n.interval<800&&(n.interval=800),n.full?n.elem.css({position:"fixed",width:"100%",height:"100%",zIndex:9999}):n.elem.css({width:n.width,height:n.height}),n.elem.attr("lay-anim",n.anim),e.elemItem.eq(n.index).addClass(a),e.elemItem.length<=1||(e.indicator(),e.arrow(),e.autoplay(),e.events()))},m.prototype.reload=function(e){var n=this;clearInterval(n.timer),n.config=i.extend({},n.config,e),n.render()},m.prototype.prevIndex=function(){var e=this,i=e.config,n=i.index-1;return n<0&&(n=e.elemItem.length-1),n},m.prototype.nextIndex=function(){var e=this,i=e.config,n=i.index+1;return n>=e.elemItem.length&&(n=0),n},m.prototype.addIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index+e,n.index>=i.elemItem.length&&(n.index=0)},m.prototype.subIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index-e,n.index<0&&(n.index=i.elemItem.length-1)},m.prototype.autoplay=function(){var e=this,i=e.config;i.autoplay&&(clearInterval(e.timer),e.timer=setInterval(function(){e.slide()},i.interval))},m.prototype.arrow=function(){var e=this,n=e.config,t=i(['<button class="layui-icon '+u+'" lay-type="sub">'+("updown"===n.anim?"":"")+"</button>",'<button class="layui-icon '+u+'" lay-type="add">'+("updown"===n.anim?"":"")+"</button>"].join(""));n.elem.attr("lay-arrow",n.arrow),n.elem.find("."+u)[0]&&n.elem.find("."+u).remove(),n.elem.append(t),t.on("click",function(){var n=i(this),t=n.attr("lay-type");e.slide(t)})},m.prototype.indicator=function(){var e=this,n=e.config,t=e.elemInd=i(['<div class="'+c+'"><ul>',function(){var i=[];return layui.each(e.elemItem,function(e){i.push("<li"+(n.index===e?' class="layui-this"':"")+"></li>")}),i.join("")}(),"</ul></div>"].join(""));n.elem.attr("lay-indicator",n.indicator),n.elem.find("."+c)[0]&&n.elem.find("."+c).remove(),n.elem.append(t),"updown"===n.anim&&t.css("margin-top",-(t.height()/2)),t.find("li").on("hover"===n.trigger?"mouseover":n.trigger,function(){var t=i(this),a=t.index();a>n.index?e.slide("add",a-n.index):a<n.index&&e.slide("sub",n.index-a)})},m.prototype.slide=function(e,i){var n=this,l=n.elemItem,u=n.config,c=u.index,m=u.elem.attr("lay-filter");n.haveSlide||("sub"===e?(n.subIndex(i),l.eq(u.index).addClass(d),setTimeout(function(){l.eq(c).addClass(r),l.eq(u.index).addClass(r)},50)):(n.addIndex(i),l.eq(u.index).addClass(s),setTimeout(function(){l.eq(c).addClass(o),l.eq(u.index).addClass(o)},50)),setTimeout(function(){l.removeClass(a+" "+d+" "+s+" "+o+" "+r),l.eq(u.index).addClass(a),n.haveSlide=!1},300),n.elemInd.find("li").eq(u.index).addClass(a).siblings().removeClass(a),n.haveSlide=!0,layui.event.call(this,t,"change("+m+")",{index:u.index,prevIndex:c,item:l.eq(u.index)}))},m.prototype.events=function(){var e=this,i=e.config;i.elem.data("haveEvents")||(i.elem.on("mouseenter",function(){clearInterval(e.timer)}).on("mouseleave",function(){e.autoplay()}),i.elem.data("haveEvents",!0))},n.render=function(e){var i=new m(e);return i},e(t,n)});
|
2
dist/lay/modules/code.js
vendored
2
dist/lay/modules/code.js
vendored
@ -1,2 +1,2 @@
|
||||
/** layui-v2.5.5 MIT License By https://www.layui.com */
|
||||
/** layui-v2.5.6 MIT License By https://www.layui.com */
|
||||
;layui.define("jquery",function(e){"use strict";var a=layui.$,l="http://www.layui.com/doc/modules/code.html";e("code",function(e){var t=[];e=e||{},e.elem=a(e.elem||".layui-code"),e.about=!("about"in e)||e.about,e.elem.each(function(){t.push(this)}),layui.each(t.reverse(),function(t,i){var c=a(i),o=c.html();(c.attr("lay-encode")||e.encode)&&(o=o.replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")),c.html('<ol class="layui-code-ol"><li>'+o.replace(/[\r\t\n]+/g,"</li><li>")+"</li></ol>"),c.find(">.layui-code-h3")[0]||c.prepend('<h3 class="layui-code-h3">'+(c.attr("lay-title")||e.title||"code")+(e.about?'<a href="'+l+'" target="_blank">layui.code</a>':"")+"</h3>");var d=c.find(">.layui-code-ol");c.addClass("layui-box layui-code-view"),(c.attr("lay-skin")||e.skin)&&c.addClass("layui-code-"+(c.attr("lay-skin")||e.skin)),(d.find("li").length/100|0)>0&&d.css("margin-left",(d.find("li").length/100|0)+"px"),(c.attr("lay-height")||e.height)&&d.css("max-height",c.attr("lay-height")||e.height)})})}).addcss("modules/code.css","skincodecss");
|
2
dist/lay/modules/colorpicker.js
vendored
2
dist/lay/modules/colorpicker.js
vendored
File diff suppressed because one or more lines are too long
2
dist/lay/modules/element.js
vendored
2
dist/lay/modules/element.js
vendored
File diff suppressed because one or more lines are too long
4
dist/lay/modules/flow.js
vendored
4
dist/lay/modules/flow.js
vendored
@ -1,2 +1,2 @@
|
||||
/** layui-v2.5.5 MIT License By https://www.layui.com */
|
||||
;layui.define("jquery",function(e){"use strict";var l=layui.$,o=function(e){},t='<i class="layui-anim layui-anim-rotate layui-anim-loop layui-icon "></i>';o.prototype.load=function(e){var o,i,n,r,a=this,c=0;e=e||{};var f=l(e.elem);if(f[0]){var m=l(e.scrollElem||document),u=e.mb||50,s=!("isAuto"in e)||e.isAuto,v=e.end||"没有更多了",y=e.scrollElem&&e.scrollElem!==document,d="<cite>加载更多</cite>",h=l('<div class="layui-flow-more"><a href="javascript:;">'+d+"</a></div>");f.find(".layui-flow-more")[0]||f.append(h);var p=function(e,t){e=l(e),h.before(e),t=0==t||null,t?h.html(v):h.find("a").html(d),i=t,o=null,n&&n()},g=function(){o=!0,h.find("a").html(t),"function"==typeof e.done&&e.done(++c,p)};if(g(),h.find("a").on("click",function(){l(this);i||o||g()}),e.isLazyimg)var n=a.lazyimg({elem:e.elem+" img",scrollElem:e.scrollElem});return s?(m.on("scroll",function(){var e=l(this),t=e.scrollTop();r&&clearTimeout(r),i||(r=setTimeout(function(){var i=y?e.height():l(window).height(),n=y?e.prop("scrollHeight"):document.documentElement.scrollHeight;n-t-i<=u&&(o||g())},100))}),a):a}},o.prototype.lazyimg=function(e){var o,t=this,i=0;e=e||{};var n=l(e.scrollElem||document),r=e.elem||"img",a=e.scrollElem&&e.scrollElem!==document,c=function(e,l){var o=n.scrollTop(),r=o+l,c=a?function(){return e.offset().top-n.offset().top+o}():e.offset().top;if(c>=o&&c<=r&&!e.attr("src")){var m=e.attr("lay-src");layui.img(m,function(){var l=t.lazyimg.elem.eq(i);e.attr("src",m).removeAttr("lay-src"),l[0]&&f(l),i++})}},f=function(e,o){var f=a?(o||n).height():l(window).height(),m=n.scrollTop(),u=m+f;if(t.lazyimg.elem=l(r),e)c(e,f);else for(var s=0;s<t.lazyimg.elem.length;s++){var v=t.lazyimg.elem.eq(s),y=a?function(){return v.offset().top-n.offset().top+m}():v.offset().top;if(c(v,f),i=s,y>u)break}};if(f(),!o){var m;n.on("scroll",function(){var e=l(this);m&&clearTimeout(m),m=setTimeout(function(){f(null,e)},50)}),o=!0}return f},e("flow",new o)});
|
||||
/** layui-v2.5.6 MIT License By https://www.layui.com */
|
||||
;layui.define("jquery",function(e){"use strict";var l=layui.$,o=function(e){},t='<i class="layui-anim layui-anim-rotate layui-anim-loop layui-icon "></i>';o.prototype.load=function(e){var o,i,n,r,a=this,c=0;e=e||{};var f=l(e.elem);if(f[0]){var m=l(e.scrollElem||document),u=e.mb||50,s=!("isAuto"in e)||e.isAuto,v=e.end||"没有更多了",y=e.scrollElem&&e.scrollElem!==document,d="<cite>加载更多</cite>",h=l('<div class="layui-flow-more"><a href="javascript:;">'+d+"</a></div>");f.find(".layui-flow-more")[0]||f.append(h);var p=function(e,t){e=l(e),h.before(e),t=0==t||null,t?h.html(v):h.find("a").html(d),i=t,o=null,n&&n()},g=function(){o=!0,h.find("a").html(t),"function"==typeof e.done&&e.done(++c,p)};if(g(),h.find("a").on("click",function(){l(this);i||o||g()}),e.isLazyimg)var n=a.lazyimg({elem:e.elem+" img",scrollElem:e.scrollElem});return s?(m.on("scroll",function(){var e=l(this),t=e.scrollTop();r&&clearTimeout(r),!i&&f.width()&&(r=setTimeout(function(){var i=y?e.height():l(window).height(),n=y?e.prop("scrollHeight"):document.documentElement.scrollHeight;n-t-i<=u&&(o||g())},100))}),a):a}},o.prototype.lazyimg=function(e){var o,t=this,i=0;e=e||{};var n=l(e.scrollElem||document),r=e.elem||"img",a=e.scrollElem&&e.scrollElem!==document,c=function(e,l){var o=n.scrollTop(),r=o+l,c=a?function(){return e.offset().top-n.offset().top+o}():e.offset().top;if(c>=o&&c<=r&&!e.attr("src")){var m=e.attr("lay-src");layui.img(m,function(){var l=t.lazyimg.elem.eq(i);e.attr("src",m).removeAttr("lay-src"),l[0]&&f(l),i++})}},f=function(e,o){var f=a?(o||n).height():l(window).height(),m=n.scrollTop(),u=m+f;if(t.lazyimg.elem=l(r),e)c(e,f);else for(var s=0;s<t.lazyimg.elem.length;s++){var v=t.lazyimg.elem.eq(s),y=a?function(){return v.offset().top-n.offset().top+m}():v.offset().top;if(c(v,f),i=s,y>u)break}};if(f(),!o){var m;n.on("scroll",function(){var e=l(this);m&&clearTimeout(m),m=setTimeout(function(){f(null,e)},50)}),o=!0}return f},e("flow",new o)});
|
4
dist/lay/modules/form.js
vendored
4
dist/lay/modules/form.js
vendored
File diff suppressed because one or more lines are too long
2
dist/lay/modules/jquery.js
vendored
2
dist/lay/modules/jquery.js
vendored
File diff suppressed because one or more lines are too long
2
dist/lay/modules/laydate.js
vendored
2
dist/lay/modules/laydate.js
vendored
File diff suppressed because one or more lines are too long
2
dist/lay/modules/layedit.js
vendored
2
dist/lay/modules/layedit.js
vendored
File diff suppressed because one or more lines are too long
2
dist/lay/modules/layer.js
vendored
2
dist/lay/modules/layer.js
vendored
File diff suppressed because one or more lines are too long
2
dist/lay/modules/laypage.js
vendored
2
dist/lay/modules/laypage.js
vendored
@ -1,2 +1,2 @@
|
||||
/** layui-v2.5.5 MIT License By https://www.layui.com */
|
||||
/** layui-v2.5.6 MIT License By https://www.layui.com */
|
||||
;layui.define(function(e){"use strict";var a=document,t="getElementById",n="getElementsByTagName",i="laypage",r="layui-disabled",u=function(e){var a=this;a.config=e||{},a.config.index=++s.index,a.render(!0)};u.prototype.type=function(){var e=this.config;if("object"==typeof e.elem)return void 0===e.elem.length?2:3},u.prototype.view=function(){var e=this,a=e.config,t=a.groups="groups"in a?0|a.groups:5;a.layout="object"==typeof a.layout?a.layout:["prev","page","next"],a.count=0|a.count,a.curr=0|a.curr||1,a.limits="object"==typeof a.limits?a.limits:[10,20,30,40,50],a.limit=0|a.limit||10,a.pages=Math.ceil(a.count/a.limit)||1,a.curr>a.pages&&(a.curr=a.pages),t<0?t=1:t>a.pages&&(t=a.pages),a.prev="prev"in a?a.prev:"上一页",a.next="next"in a?a.next:"下一页";var n=a.pages>t?Math.ceil((a.curr+(t>1?1:0))/(t>0?t:1)):1,i={prev:function(){return a.prev?'<a href="javascript:;" class="layui-laypage-prev'+(1==a.curr?" "+r:"")+'" data-page="'+(a.curr-1)+'">'+a.prev+"</a>":""}(),page:function(){var e=[];if(a.count<1)return"";n>1&&a.first!==!1&&0!==t&&e.push('<a href="javascript:;" class="layui-laypage-first" data-page="1" title="首页">'+(a.first||1)+"</a>");var i=Math.floor((t-1)/2),r=n>1?a.curr-i:1,u=n>1?function(){var e=a.curr+(t-i-1);return e>a.pages?a.pages:e}():t;for(u-r<t-1&&(r=u-t+1),a.first!==!1&&r>2&&e.push('<span class="layui-laypage-spr">…</span>');r<=u;r++)r===a.curr?e.push('<span class="layui-laypage-curr"><em class="layui-laypage-em" '+(/^#/.test(a.theme)?'style="background-color:'+a.theme+';"':"")+"></em><em>"+r+"</em></span>"):e.push('<a href="javascript:;" data-page="'+r+'">'+r+"</a>");return a.pages>t&&a.pages>u&&a.last!==!1&&(u+1<a.pages&&e.push('<span class="layui-laypage-spr">…</span>'),0!==t&&e.push('<a href="javascript:;" class="layui-laypage-last" title="尾页" data-page="'+a.pages+'">'+(a.last||a.pages)+"</a>")),e.join("")}(),next:function(){return a.next?'<a href="javascript:;" class="layui-laypage-next'+(a.curr==a.pages?" "+r:"")+'" data-page="'+(a.curr+1)+'">'+a.next+"</a>":""}(),count:'<span class="layui-laypage-count">共 '+a.count+" 条</span>",limit:function(){var e=['<span class="layui-laypage-limits"><select lay-ignore>'];return layui.each(a.limits,function(t,n){e.push('<option value="'+n+'"'+(n===a.limit?"selected":"")+">"+n+" 条/页</option>")}),e.join("")+"</select></span>"}(),refresh:['<a href="javascript:;" data-page="'+a.curr+'" class="layui-laypage-refresh">','<i class="layui-icon layui-icon-refresh"></i>',"</a>"].join(""),skip:function(){return['<span class="layui-laypage-skip">到第','<input type="text" min="1" value="'+a.curr+'" class="layui-input">','页<button type="button" class="layui-laypage-btn">确定</button>',"</span>"].join("")}()};return['<div class="layui-box layui-laypage layui-laypage-'+(a.theme?/^#/.test(a.theme)?"molv":a.theme:"default")+'" id="layui-laypage-'+a.index+'">',function(){var e=[];return layui.each(a.layout,function(a,t){i[t]&&e.push(i[t])}),e.join("")}(),"</div>"].join("")},u.prototype.jump=function(e,a){if(e){var t=this,i=t.config,r=e.children,u=e[n]("button")[0],l=e[n]("input")[0],p=e[n]("select")[0],c=function(){var e=0|l.value.replace(/\s|\D/g,"");e&&(i.curr=e,t.render())};if(a)return c();for(var o=0,y=r.length;o<y;o++)"a"===r[o].nodeName.toLowerCase()&&s.on(r[o],"click",function(){var e=0|this.getAttribute("data-page");e<1||e>i.pages||(i.curr=e,t.render())});p&&s.on(p,"change",function(){var e=this.value;i.curr*e>i.count&&(i.curr=Math.ceil(i.count/e)),i.limit=e,t.render()}),u&&s.on(u,"click",function(){c()})}},u.prototype.skip=function(e){if(e){var a=this,t=e[n]("input")[0];t&&s.on(t,"keyup",function(t){var n=this.value,i=t.keyCode;/^(37|38|39|40)$/.test(i)||(/\D/.test(n)&&(this.value=n.replace(/\D/,"")),13===i&&a.jump(e,!0))})}},u.prototype.render=function(e){var n=this,i=n.config,r=n.type(),u=n.view();2===r?i.elem&&(i.elem.innerHTML=u):3===r?i.elem.html(u):a[t](i.elem)&&(a[t](i.elem).innerHTML=u),i.jump&&i.jump(i,e);var s=a[t]("layui-laypage-"+i.index);n.jump(s),i.hash&&!e&&(location.hash="!"+i.hash+"="+i.curr),n.skip(s)};var s={render:function(e){var a=new u(e);return a.index},index:layui.laypage?layui.laypage.index+1e4:0,on:function(e,a,t){return e.attachEvent?e.attachEvent("on"+a,function(a){a.target=a.srcElement,t.call(e,a)}):e.addEventListener(a,t,!1),this}};e(i,s)});
|
2
dist/lay/modules/laytpl.js
vendored
2
dist/lay/modules/laytpl.js
vendored
@ -1,2 +1,2 @@
|
||||
/** layui-v2.5.5 MIT License By https://www.layui.com */
|
||||
/** layui-v2.5.6 MIT License By https://www.layui.com */
|
||||
;layui.define(function(e){"use strict";var r={open:"{{",close:"}}"},c={exp:function(e){return new RegExp(e,"g")},query:function(e,c,t){var o=["#([\\s\\S])+?","([^{#}])*?"][e||0];return n((c||"")+r.open+o+r.close+(t||""))},escape:function(e){return String(e||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")},error:function(e,r){var c="Laytpl Error:";return"object"==typeof console&&console.error(c+e+"\n"+(r||"")),c+e}},n=c.exp,t=function(e){this.tpl=e};t.pt=t.prototype,window.errors=0,t.pt.parse=function(e,t){var o=this,p=e,a=n("^"+r.open+"#",""),l=n(r.close+"$","");e=e.replace(/\s+|\r|\t|\n/g," ").replace(n(r.open+"#"),r.open+"# ").replace(n(r.close+"}"),"} "+r.close).replace(/\\/g,"\\\\").replace(n(r.open+"!(.+?)!"+r.close),function(e){return e=e.replace(n("^"+r.open+"!"),"").replace(n("!"+r.close),"").replace(n(r.open+"|"+r.close),function(e){return e.replace(/(.)/g,"\\$1")})}).replace(/(?="|')/g,"\\").replace(c.query(),function(e){return e=e.replace(a,"").replace(l,""),'";'+e.replace(/\\/g,"")+';view+="'}).replace(c.query(1),function(e){var c='"+(';return e.replace(/\s/g,"")===r.open+r.close?"":(e=e.replace(n(r.open+"|"+r.close),""),/^=/.test(e)&&(e=e.replace(/^=/,""),c='"+_escape_('),c+e.replace(/\\/g,"")+')+"')}),e='"use strict";var view = "'+e+'";return view;';try{return o.cache=e=new Function("d, _escape_",e),e(t,c.escape)}catch(u){return delete o.cache,c.error(u,p)}},t.pt.render=function(e,r){var n,t=this;return e?(n=t.cache?t.cache(e,c.escape):t.parse(t.tpl,e),r?void r(n):n):c.error("no data")};var o=function(e){return"string"!=typeof e?c.error("Template not found"):new t(e)};o.config=function(e){e=e||{};for(var c in e)r[c]=e[c]},o.v="1.2.0",e("laytpl",o)});
|
2
dist/lay/modules/mobile.js
vendored
2
dist/lay/modules/mobile.js
vendored
File diff suppressed because one or more lines are too long
2
dist/lay/modules/rate.js
vendored
2
dist/lay/modules/rate.js
vendored
@ -1,2 +1,2 @@
|
||||
/** layui-v2.5.5 MIT License By https://www.layui.com */
|
||||
/** layui-v2.5.6 MIT License By https://www.layui.com */
|
||||
;layui.define("jquery",function(e){"use strict";var a=layui.jquery,i={config:{},index:layui.rate?layui.rate.index+1e4:0,set:function(e){var i=this;return i.config=a.extend({},i.config,e),i},on:function(e,a){return layui.onevent.call(this,n,e,a)}},l=function(){var e=this,a=e.config;return{setvalue:function(a){e.setvalue.call(e,a)},config:a}},n="rate",t="layui-rate",o="layui-icon-rate",s="layui-icon-rate-solid",u="layui-icon-rate-half",r="layui-icon-rate-solid layui-icon-rate-half",c="layui-icon-rate-solid layui-icon-rate",f="layui-icon-rate layui-icon-rate-half",v=function(e){var l=this;l.index=++i.index,l.config=a.extend({},l.config,i.config,e),l.render()};v.prototype.config={length:5,text:!1,readonly:!1,half:!1,value:0,theme:""},v.prototype.render=function(){var e=this,i=e.config,l=i.theme?'style="color: '+i.theme+';"':"";i.elem=a(i.elem),parseInt(i.value)!==i.value&&(i.half||(i.value=Math.ceil(i.value)-i.value<.5?Math.ceil(i.value):Math.floor(i.value)));for(var n='<ul class="layui-rate" '+(i.readonly?"readonly":"")+">",u=1;u<=i.length;u++){var r='<li class="layui-inline"><i class="layui-icon '+(u>Math.floor(i.value)?o:s)+'" '+l+"></i></li>";i.half&&parseInt(i.value)!==i.value&&u==Math.ceil(i.value)?n=n+'<li><i class="layui-icon layui-icon-rate-half" '+l+"></i></li>":n+=r}n+="</ul>"+(i.text?'<span class="layui-inline">'+i.value+"星":"")+"</span>";var c=i.elem,f=c.next("."+t);f[0]&&f.remove(),e.elemTemp=a(n),i.span=e.elemTemp.next("span"),i.setText&&i.setText(i.value),c.html(e.elemTemp),c.addClass("layui-inline"),i.readonly||e.action()},v.prototype.setvalue=function(e){var a=this,i=a.config;i.value=e,a.render()},v.prototype.action=function(){var e=this,i=e.config,l=e.elemTemp,n=l.find("i").width();l.children("li").each(function(e){var t=e+1,v=a(this);v.on("click",function(e){if(i.value=t,i.half){var o=e.pageX-a(this).offset().left;o<=n/2&&(i.value=i.value-.5)}i.text&&l.next("span").text(i.value+"星"),i.choose&&i.choose(i.value),i.setText&&i.setText(i.value)}),v.on("mousemove",function(e){if(l.find("i").each(function(){a(this).addClass(o).removeClass(r)}),l.find("i:lt("+t+")").each(function(){a(this).addClass(s).removeClass(f)}),i.half){var c=e.pageX-a(this).offset().left;c<=n/2&&v.children("i").addClass(u).removeClass(s)}}),v.on("mouseleave",function(){l.find("i").each(function(){a(this).addClass(o).removeClass(r)}),l.find("i:lt("+Math.floor(i.value)+")").each(function(){a(this).addClass(s).removeClass(f)}),i.half&&parseInt(i.value)!==i.value&&l.children("li:eq("+Math.floor(i.value)+")").children("i").addClass(u).removeClass(c)})})},v.prototype.events=function(){var e=this;e.config},i.render=function(e){var a=new v(e);return l.call(a)},e(n,i)});
|
2
dist/lay/modules/slider.js
vendored
2
dist/lay/modules/slider.js
vendored
File diff suppressed because one or more lines are too long
4
dist/lay/modules/table.js
vendored
4
dist/lay/modules/table.js
vendored
File diff suppressed because one or more lines are too long
2
dist/lay/modules/transfer.js
vendored
2
dist/lay/modules/transfer.js
vendored
File diff suppressed because one or more lines are too long
2
dist/lay/modules/tree.js
vendored
2
dist/lay/modules/tree.js
vendored
File diff suppressed because one or more lines are too long
4
dist/lay/modules/upload.js
vendored
4
dist/lay/modules/upload.js
vendored
File diff suppressed because one or more lines are too long
4
dist/lay/modules/util.js
vendored
4
dist/lay/modules/util.js
vendored
@ -1,2 +1,2 @@
|
||||
/** layui-v2.5.5 MIT License By https://www.layui.com */
|
||||
;layui.define("jquery",function(t){"use strict";var e=layui.$,i={fixbar:function(t){var i,n,a="layui-fixbar",o="layui-fixbar-top",r=e(document),l=e("body");t=e.extend({showHeight:200},t),t.bar1=t.bar1===!0?"":t.bar1,t.bar2=t.bar2===!0?"":t.bar2,t.bgcolor=t.bgcolor?"background-color:"+t.bgcolor:"";var c=[t.bar1,t.bar2,""],g=e(['<ul class="'+a+'">',t.bar1?'<li class="layui-icon" lay-type="bar1" style="'+t.bgcolor+'">'+c[0]+"</li>":"",t.bar2?'<li class="layui-icon" lay-type="bar2" style="'+t.bgcolor+'">'+c[1]+"</li>":"",'<li class="layui-icon '+o+'" lay-type="top" style="'+t.bgcolor+'">'+c[2]+"</li>","</ul>"].join("")),s=g.find("."+o),u=function(){var e=r.scrollTop();e>=t.showHeight?i||(s.show(),i=1):i&&(s.hide(),i=0)};e("."+a)[0]||("object"==typeof t.css&&g.css(t.css),l.append(g),u(),g.find("li").on("click",function(){var i=e(this),n=i.attr("lay-type");"top"===n&&e("html,body").animate({scrollTop:0},200),t.click&&t.click.call(this,n)}),r.on("scroll",function(){clearTimeout(n),n=setTimeout(function(){u()},100)}))},countdown:function(t,e,i){var n=this,a="function"==typeof e,o=new Date(t).getTime(),r=new Date(!e||a?(new Date).getTime():e).getTime(),l=o-r,c=[Math.floor(l/864e5),Math.floor(l/36e5)%24,Math.floor(l/6e4)%60,Math.floor(l/1e3)%60];a&&(i=e);var g=setTimeout(function(){n.countdown(t,r+1e3,i)},1e3);return i&&i(l>0?c:[0,0,0,0],e,g),l<=0&&clearTimeout(g),g},timeAgo:function(t,e){var i=this,n=[[],[]],a=(new Date).getTime()-new Date(t).getTime();return a>6912e5?(a=new Date(t),n[0][0]=i.digit(a.getFullYear(),4),n[0][1]=i.digit(a.getMonth()+1),n[0][2]=i.digit(a.getDate()),e||(n[1][0]=i.digit(a.getHours()),n[1][1]=i.digit(a.getMinutes()),n[1][2]=i.digit(a.getSeconds())),n[0].join("-")+" "+n[1].join(":")):a>=864e5?(a/1e3/60/60/24|0)+"天前":a>=36e5?(a/1e3/60/60|0)+"小时前":a>=12e4?(a/1e3/60|0)+"分钟前":a<0?"未来":"刚刚"},digit:function(t,e){var i="";t=String(t),e=e||2;for(var n=t.length;n<e;n++)i+="0";return t<Math.pow(10,e)?i+(0|t):t},toDateString:function(t,e){var i=this,n=new Date(t||new Date),a=[i.digit(n.getFullYear(),4),i.digit(n.getMonth()+1),i.digit(n.getDate())],o=[i.digit(n.getHours()),i.digit(n.getMinutes()),i.digit(n.getSeconds())];return e=e||"yyyy-MM-dd HH:mm:ss",e.replace(/yyyy/g,a[0]).replace(/MM/g,a[1]).replace(/dd/g,a[2]).replace(/HH/g,o[0]).replace(/mm/g,o[1]).replace(/ss/g,o[2])},escape:function(t){return String(t||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")},event:function(t,n,a){n=i.event[t]=e.extend(!0,i.event[t],n)||{},e("body").on(a||"click","*["+t+"]",function(){var i=e(this),a=i.attr(t);n[a]&&n[a].call(this,i)})}};!function(t,e,i){"$:nomunge";function n(){a=e[l](function(){o.each(function(){var e=t(this),i=e.width(),n=e.height(),a=t.data(this,g);(i!==a.w||n!==a.h)&&e.trigger(c,[a.w=i,a.h=n])}),n()},r[s])}var a,o=t([]),r=t.resize=t.extend(t.resize,{}),l="setTimeout",c="resize",g=c+"-special-event",s="delay",u="throttleWindow";r[s]=250,r[u]=!0,t.event.special[c]={setup:function(){if(!r[u]&&this[l])return!1;var e=t(this);o=o.add(e),t.data(this,g,{w:e.width(),h:e.height()}),1===o.length&&n()},teardown:function(){if(!r[u]&&this[l])return!1;var e=t(this);o=o.not(e),e.removeData(g),o.length||clearTimeout(a)},add:function(e){function n(e,n,o){var r=t(this),l=t.data(this,g)||{};l.w=n!==i?n:r.width(),l.h=o!==i?o:r.height(),a.apply(this,arguments)}if(!r[u]&&this[l])return!1;var a;return t.isFunction(e)?(a=e,n):(a=e.handler,void(e.handler=n))}}}(e,window),t("util",i)});
|
||||
/** layui-v2.5.6 MIT License By https://www.layui.com */
|
||||
;layui.define("jquery",function(e){"use strict";var t=layui.$,i={fixbar:function(e){var i,n,a="layui-fixbar",o="layui-fixbar-top",r=t(document),l=t("body");e=t.extend({showHeight:200},e),e.bar1=e.bar1===!0?"":e.bar1,e.bar2=e.bar2===!0?"":e.bar2,e.bgcolor=e.bgcolor?"background-color:"+e.bgcolor:"";var c=[e.bar1,e.bar2,""],u=t(['<ul class="'+a+'">',e.bar1?'<li class="layui-icon" lay-type="bar1" style="'+e.bgcolor+'">'+c[0]+"</li>":"",e.bar2?'<li class="layui-icon" lay-type="bar2" style="'+e.bgcolor+'">'+c[1]+"</li>":"",'<li class="layui-icon '+o+'" lay-type="top" style="'+e.bgcolor+'">'+c[2]+"</li>","</ul>"].join("")),g=u.find("."+o),s=function(){var t=r.scrollTop();t>=e.showHeight?i||(g.show(),i=1):i&&(g.hide(),i=0)};t("."+a)[0]||("object"==typeof e.css&&u.css(e.css),l.append(u),s(),u.find("li").on("click",function(){var i=t(this),n=i.attr("lay-type");"top"===n&&t("html,body").animate({scrollTop:0},200),e.click&&e.click.call(this,n)}),r.on("scroll",function(){clearTimeout(n),n=setTimeout(function(){s()},100)}))},countdown:function(e,t,i){var n=this,a="function"==typeof t,o=new Date(e).getTime(),r=new Date(!t||a?(new Date).getTime():t).getTime(),l=o-r,c=[Math.floor(l/864e5),Math.floor(l/36e5)%24,Math.floor(l/6e4)%60,Math.floor(l/1e3)%60];a&&(i=t);var u=setTimeout(function(){n.countdown(e,r+1e3,i)},1e3);return i&&i(l>0?c:[0,0,0,0],t,u),l<=0&&clearTimeout(u),u},timeAgo:function(e,t){var i=this,n=[[],[]],a=(new Date).getTime()-new Date(e).getTime();return a>26784e5?(a=new Date(e),n[0][0]=i.digit(a.getFullYear(),4),n[0][1]=i.digit(a.getMonth()+1),n[0][2]=i.digit(a.getDate()),t||(n[1][0]=i.digit(a.getHours()),n[1][1]=i.digit(a.getMinutes()),n[1][2]=i.digit(a.getSeconds())),n[0].join("-")+" "+n[1].join(":")):a>=864e5?(a/1e3/60/60/24|0)+"天前":a>=36e5?(a/1e3/60/60|0)+"小时前":a>=18e4?(a/1e3/60|0)+"分钟前":a<0?"未来":"刚刚"},digit:function(e,t){var i="";e=String(e),t=t||2;for(var n=e.length;n<t;n++)i+="0";return e<Math.pow(10,t)?i+(0|e):e},toDateString:function(e,t){var i=this,n=new Date(e||new Date),a=[i.digit(n.getFullYear(),4),i.digit(n.getMonth()+1),i.digit(n.getDate())],o=[i.digit(n.getHours()),i.digit(n.getMinutes()),i.digit(n.getSeconds())];return t=t||"yyyy-MM-dd HH:mm:ss",t.replace(/yyyy/g,a[0]).replace(/MM/g,a[1]).replace(/dd/g,a[2]).replace(/HH/g,o[0]).replace(/mm/g,o[1]).replace(/ss/g,o[2])},escape:function(e){return String(e||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")},event:function(e,n,a){var o=t("body");return a=a||"click",n=i.event[e]=t.extend(!0,i.event[e],n)||{},i.event.UTIL_EVENT_CALLBACK=i.event.UTIL_EVENT_CALLBACK||{},o.off(a,"*["+e+"]",i.event.UTIL_EVENT_CALLBACK[e]),i.event.UTIL_EVENT_CALLBACK[e]=function(){var i=t(this),a=i.attr(e);"function"==typeof n[a]&&n[a].call(this,i)},o.on(a,"*["+e+"]",i.event.UTIL_EVENT_CALLBACK[e]),n}};!function(e,t,i){"$:nomunge";function n(){a=t[l](function(){o.each(function(){var t=e(this),i=t.width(),n=t.height(),a=e.data(this,u);(i!==a.w||n!==a.h)&&t.trigger(c,[a.w=i,a.h=n])}),n()},r[g])}var a,o=e([]),r=e.resize=e.extend(e.resize,{}),l="setTimeout",c="resize",u=c+"-special-event",g="delay",s="throttleWindow";r[g]=250,r[s]=!0,e.event.special[c]={setup:function(){if(!r[s]&&this[l])return!1;var t=e(this);o=o.add(t),e.data(this,u,{w:t.width(),h:t.height()}),1===o.length&&n()},teardown:function(){if(!r[s]&&this[l])return!1;var t=e(this);o=o.not(t),t.removeData(u),o.length||clearTimeout(a)},add:function(t){function n(t,n,o){var r=e(this),l=e.data(this,u)||{};l.w=n!==i?n:r.width(),l.h=o!==i?o:r.height(),a.apply(this,arguments)}if(!r[s]&&this[l])return!1;var a;return e.isFunction(t)?(a=t,n):(a=t.handler,void(t.handler=n))}}}(t,window),e("util",i)});
|
6
dist/layui.all.js
vendored
6
dist/layui.all.js
vendored
File diff suppressed because one or more lines are too long
4
dist/layui.js
vendored
4
dist/layui.js
vendored
File diff suppressed because one or more lines are too long
@ -18,7 +18,11 @@ img{width: 500px; height: 300px;}
|
||||
<body>
|
||||
|
||||
|
||||
<ul class="flow-default"></ul>
|
||||
<ul class="flow-default" id="test1"></ul>
|
||||
|
||||
<div class="layui-hide">
|
||||
<ul class="flow-default" id="test2"></ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="demo" style="height: 200px; overflow: auto;">
|
||||
@ -41,13 +45,30 @@ layui.use('flow', function(){
|
||||
var flow = layui.flow;
|
||||
|
||||
flow.load({
|
||||
elem: '.flow-default' //流加载容器
|
||||
elem: '#test1' //流加载容器
|
||||
//,scrollElem: '.flow-default' //滚动条所在元素,默认document
|
||||
//,isAuto: false
|
||||
//,end: '没了'
|
||||
,isLazyimg: true
|
||||
,done: function(page, next){ //加载下一页
|
||||
console.log('done:', page)
|
||||
setTimeout(function(){
|
||||
var lis = [];
|
||||
for(var i = 0; i < 6; i++){
|
||||
lis.push('<li><img lay-src="http://s6.mogucdn.com/p2/160914/iz_5lc1cdg3j2hibl9ai99lg7c28k1fh_305x330.jpg?v='+ (page+i) +'"></li>')
|
||||
}
|
||||
next(lis.join(''), page < 3);
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
|
||||
flow.load({
|
||||
elem: '#test2' //流加载容器
|
||||
//,scrollElem: '.flow-default' //滚动条所在元素,默认document
|
||||
//,isAuto: false
|
||||
//,end: '没了'
|
||||
,isLazyimg: true
|
||||
,done: function(page, next){ //加载下一页
|
||||
console.log(page)
|
||||
setTimeout(function(){
|
||||
var lis = [];
|
||||
for(var i = 0; i < 6; i++){
|
||||
|
@ -273,41 +273,24 @@ layui.use(['form', 'layedit', 'laydate'], function(){
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<form id="test">
|
||||
<form id="test1" action="" target="_blank">
|
||||
<input type="radio" value="girl" disabled>
|
||||
<input type="checkbox" name="love[a]">
|
||||
<input type="checkbox" name="love[b]">
|
||||
<input value="1">
|
||||
<input name="as">
|
||||
<input name="=" value="2">
|
||||
<select name="quiz">
|
||||
<option value="">请选择问题</option>
|
||||
<option disabled value="你工作的第一个城市">你工作的第一个城市</option>
|
||||
<option value="你的工号">你的工号</option>
|
||||
<option value="你最喜欢的老师">你最喜欢的老师</option>
|
||||
<option value="你的工号">你的工号</option>
|
||||
<option value="你的工号">你的工号</option>
|
||||
<option value="你的工号">你的工号</option>
|
||||
<option value="你的工号">你的工号</option>
|
||||
<option value="你的工号">你的工号</option>
|
||||
<option value="你的工号">你的工号</option>
|
||||
<option value="你的工号">你的工号</option>
|
||||
<option value="你的工号">你的工号</option>
|
||||
<option value="你的工号">你的工号</option>
|
||||
<option value="你的工号">你的工号</option>
|
||||
<option value="你的工号">你的工号</option>
|
||||
<option value="你的工号">你的工号</option>
|
||||
<option value="你的工号">你的工号</option>
|
||||
<option value="你的工号">你的工号</option>
|
||||
<option value="你的工号">你的工号</option>
|
||||
<option value="你的工号">你的工号</option>
|
||||
<option value="你的工号">你的工号</option>
|
||||
<option value="你的工号" selected>你的工号</option>
|
||||
<option value="你的工号">你的工号</option>
|
||||
<option value="你的工号">你的工号</option>
|
||||
<option value="你的工号">你的工号</option>
|
||||
</select>
|
||||
<button>Go</button>
|
||||
<button type="submit">原始表单,测试提交</button>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
layui.use('jquery', function(){
|
||||
var $ = layui.jquery;
|
||||
@ -317,8 +300,9 @@ layui.use('jquery', function(){
|
||||
$('#test').on('submit', function(){
|
||||
return false
|
||||
});
|
||||
$('#test').on('submit', function(){
|
||||
return true
|
||||
$('#test1').on('submit', function(obj){
|
||||
//console.log(obj.field)
|
||||
//return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
@ -2,6 +2,10 @@
|
||||
"code": 0
|
||||
,"msg": ""
|
||||
,"count": 3000000
|
||||
,"totalRow": {
|
||||
"experience": "666"
|
||||
,"logins": "999"
|
||||
}
|
||||
,"data": [{
|
||||
"id": "10001"
|
||||
,"username": "杜甫"
|
||||
|
@ -16,7 +16,7 @@ hr{margin: 30px 0;}
|
||||
<body>
|
||||
|
||||
<div class="layui-upload">
|
||||
<button type="button" class="layui-btn" id="test1">上传图片</button>
|
||||
<button type="button" class="layui-btn" id="test1" name="123">上传图片</button>
|
||||
|
||||
<div class="layui-upload-list">
|
||||
<img class="layui-upload-img" src="" id="demo1">
|
||||
@ -94,7 +94,7 @@ layui.use(['upload', 'element'], function(){
|
||||
|
||||
var uploadInst = upload.render({
|
||||
elem: '#test1'
|
||||
,url: 'http://httpbin.org/image'
|
||||
,url: 'http://httpbin.org/post'
|
||||
//,size: 2000 //限制文件大小,单位 KB
|
||||
//,accept: 'file'
|
||||
,method: 'get'
|
||||
@ -122,6 +122,7 @@ layui.use(['upload', 'element'], function(){
|
||||
return layer.msg('上传失败');
|
||||
}
|
||||
//上传成功
|
||||
console.log(res);
|
||||
}
|
||||
,error: function(){
|
||||
this.item.html('重选上传');
|
||||
@ -135,8 +136,8 @@ layui.use(['upload', 'element'], function(){
|
||||
|
||||
element.progress('demo', '0%');
|
||||
}
|
||||
,progress: function(n){
|
||||
console.log(n + '%'); //获取进度百分比
|
||||
,progress: function(n, index, e){
|
||||
console.log(n + '%', index, e); //获取进度百分比
|
||||
element.progress('demo', n + '%'); //可配合 layui 进度条元素使用
|
||||
}
|
||||
});
|
||||
@ -291,6 +292,7 @@ layui.use(['upload', 'element'], function(){
|
||||
,choose: function(obj){
|
||||
var that = this;
|
||||
obj.preview(function(index, file){
|
||||
console.log(file.name)
|
||||
obj.resetFile(index, file, '123.jpg');
|
||||
});
|
||||
}
|
||||
@ -312,7 +314,7 @@ layui.use(['upload', 'element'], function(){
|
||||
|
||||
upload.render({
|
||||
elem: '#test9'
|
||||
,url: ''
|
||||
,url: 'http://httpbin.org/post'
|
||||
,done: function(res){
|
||||
console.log(res);
|
||||
}
|
||||
|
@ -17,6 +17,8 @@ body{padding: 50px;}
|
||||
<button class="layui-btn" lay-active="e2">事件2</button>
|
||||
<button class="layui-btn" lay-active="e3">事件3</button>
|
||||
|
||||
<button class="layui-btn" lay-active2="e4">事件4</button>
|
||||
|
||||
<hr>
|
||||
|
||||
<div id="test"></div>
|
||||
@ -60,14 +62,28 @@ layui.use('util', function(){
|
||||
|
||||
//处理属性 为 lay-active 的所有元素事件
|
||||
util.event('lay-active', {
|
||||
e1: function(){
|
||||
alert('事件1')
|
||||
e1: function(othis){
|
||||
alert(othis.html())
|
||||
}
|
||||
,e2: function(){
|
||||
alert('事件2')
|
||||
,e2: function(othis){
|
||||
alert(othis.html())
|
||||
}
|
||||
,e3: function(){
|
||||
alert('事件3')
|
||||
,e3: function(othis){
|
||||
alert(othis.html())
|
||||
}
|
||||
});
|
||||
|
||||
//测试是否重复绑定
|
||||
util.event('lay-active', {
|
||||
e1: function(othis){
|
||||
alert(othis.html() + '新事件')
|
||||
}
|
||||
});
|
||||
|
||||
//测试绑定新事件
|
||||
util.event('lay-active2', {
|
||||
e4: function(othis){
|
||||
alert(othis.html())
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "layui-src",
|
||||
"realname": "layui",
|
||||
"version": "2.5.5",
|
||||
"version": "2.5.6",
|
||||
"independents": {
|
||||
"layim": "3.9.1"
|
||||
},
|
||||
|
@ -47,12 +47,12 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
/** 图标字体 **/
|
||||
@font-face {
|
||||
font-family: 'layui-icon';
|
||||
src: url('../font/iconfont.eot?v=250');
|
||||
src: url('../font/iconfont.eot?v=250#iefix') format('embedded-opentype'),
|
||||
url('../font/iconfont.woff2?v=250') format('woff2'),
|
||||
url('../font/iconfont.woff?v=250') format('woff'),
|
||||
url('../font/iconfont.ttf?v=250') format('truetype'),
|
||||
url('../font/iconfont.svg?v=250#layui-icon') format('svg');
|
||||
src: url('../font/iconfont.eot?v=256');
|
||||
src: url('../font/iconfont.eot?v=256#iefix') format('embedded-opentype'),
|
||||
url('../font/iconfont.woff2?v=256') format('woff2'),
|
||||
url('../font/iconfont.woff?v=256') format('woff'),
|
||||
url('../font/iconfont.ttf?v=256') format('truetype'),
|
||||
url('../font/iconfont.svg?v=256#layui-icon') format('svg');
|
||||
}
|
||||
|
||||
.layui-icon{
|
||||
@ -90,6 +90,7 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
.layui-icon-face-smile:before{content:"\e6af"}
|
||||
.layui-icon-survey:before{content:"\e6b2"}
|
||||
.layui-icon-tree:before{content:"\e62e"}
|
||||
.layui-icon-ie:before{content:"\e7bb"}
|
||||
.layui-icon-upload-circle:before{content:"\e62f"}
|
||||
.layui-icon-add-circle:before{content:"\e61f"}
|
||||
.layui-icon-download-circle:before{content:"\e601"}
|
||||
@ -109,6 +110,7 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
.layui-icon-carousel:before{content:"\e634"}
|
||||
.layui-icon-help:before{content:"\e607"}
|
||||
.layui-icon-code-circle:before{content:"\e635"}
|
||||
.layui-icon-windows:before{content:"\e67f"}
|
||||
.layui-icon-water:before{content:"\e636"}
|
||||
.layui-icon-username:before{content:"\e66f"}
|
||||
.layui-icon-find-fill:before{content:"\e670"}
|
||||
@ -121,6 +123,7 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
.layui-icon-delete:before{content:"\e640"}
|
||||
.layui-icon-play:before{content:"\e652"}
|
||||
.layui-icon-top:before{content:"\e604"}
|
||||
.layui-icon-firefox:before{content:"\e686"}
|
||||
.layui-icon-friends:before{content:"\e612"}
|
||||
.layui-icon-refresh-3:before{content:"\e9aa"}
|
||||
.layui-icon-ok:before{content:"\e605"}
|
||||
@ -133,6 +136,7 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
.layui-icon-link:before{content:"\e64c"}
|
||||
.layui-icon-diamond:before{content:"\e735"}
|
||||
.layui-icon-log:before{content:"\e60e"}
|
||||
.layui-icon-key:before{content:"\e683"}
|
||||
.layui-icon-rate-solid:before{content:"\e67a"}
|
||||
.layui-icon-fonts-del:before{content:"\e64f"}
|
||||
.layui-icon-unlink:before{content:"\e64d"}
|
||||
@ -154,11 +158,15 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
.layui-icon-add-1:before{content:"\e654"}
|
||||
.layui-icon-face-smile-b:before{content:"\e650"}
|
||||
.layui-icon-fonts-html:before{content:"\e64b"}
|
||||
.layui-icon-screen-full:before{content:"\e622"}
|
||||
.layui-icon-form:before{content:"\e63c"}
|
||||
.layui-icon-cart:before{content:"\e657"}
|
||||
.layui-icon-camera-fill:before{content:"\e65d"}
|
||||
.layui-icon-tabs:before{content:"\e62a"}
|
||||
.layui-icon-heart-fill:before{content:"\e68f"}
|
||||
.layui-icon-fonts-code:before{content:"\e64e"}
|
||||
.layui-icon-ios:before{content:"\e680"}
|
||||
.layui-icon-at:before{content:"\e687"}
|
||||
.layui-icon-fire:before{content:"\e756"}
|
||||
.layui-icon-set:before{content:"\e716"}
|
||||
.layui-icon-fonts-u:before{content:"\e646"}
|
||||
@ -166,21 +174,29 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
.layui-icon-tips:before{content:"\e702"}
|
||||
.layui-icon-picture:before{content:"\e64a"}
|
||||
.layui-icon-more-vertical:before{content:"\e671"}
|
||||
.layui-icon-bluetooth:before{content:"\e689"}
|
||||
.layui-icon-flag:before{content:"\e66c"}
|
||||
.layui-icon-loading:before{content:"\e63d"}
|
||||
.layui-icon-fonts-i:before{content:"\e644"}
|
||||
.layui-icon-refresh-1:before{content:"\e666"}
|
||||
.layui-icon-rmb:before{content:"\e65e"}
|
||||
.layui-icon-addition:before{content:"\e624"}
|
||||
.layui-icon-home:before{content:"\e68e"}
|
||||
.layui-icon-time:before{content:"\e68d"}
|
||||
.layui-icon-user:before{content:"\e770"}
|
||||
.layui-icon-notice:before{content:"\e667"}
|
||||
.layui-icon-chrome:before{content:"\e68a"}
|
||||
.layui-icon-edge:before{content:"\e68b"}
|
||||
.layui-icon-login-weibo:before{content:"\e675"}
|
||||
.layui-icon-voice:before{content:"\e688"}
|
||||
.layui-icon-upload-drag:before{content:"\e681"}
|
||||
.layui-icon-login-qq:before{content:"\e676"}
|
||||
.layui-icon-snowflake:before{content:"\e6b1"}
|
||||
.layui-icon-heart:before{content:"\e68c"}
|
||||
.layui-icon-logout:before{content:"\e682"}
|
||||
.layui-icon-file-b:before{content:"\e655"}
|
||||
.layui-icon-template:before{content:"\e663"}
|
||||
.layui-icon-transfer:before{content:"\e691"}
|
||||
.layui-icon-auz:before{content:"\e672"}
|
||||
.layui-icon-console:before{content:"\e665"}
|
||||
.layui-icon-app:before{content:"\e653"}
|
||||
@ -188,6 +204,7 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
.layui-icon-website:before{content:"\e7ae"}
|
||||
.layui-icon-next:before{content:"\e65b"}
|
||||
.layui-icon-component:before{content:"\e857"}
|
||||
.layui-icon-android:before{content:"\e684"}
|
||||
.layui-icon-more:before{content:"\e65f"}
|
||||
.layui-icon-login-wechat:before{content:"\e677"}
|
||||
.layui-icon-shrink-right:before{content:"\e668"}
|
||||
@ -197,6 +214,7 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
.layui-icon-refresh:before{content:"\e669"}
|
||||
.layui-icon-female:before{content:"\e661"}
|
||||
.layui-icon-male:before{content:"\e662"}
|
||||
.layui-icon-screen-restore:before{content:"\e758"}
|
||||
.layui-icon-password:before{content:"\e673"}
|
||||
.layui-icon-senior:before{content:"\e674"}
|
||||
.layui-icon-theme:before{content:"\e66a"}
|
||||
@ -206,18 +224,22 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
.layui-icon-rate:before{content:"\e67b"}
|
||||
.layui-icon-template-1:before{content:"\e656"}
|
||||
.layui-icon-vercode:before{content:"\e679"}
|
||||
.layui-icon-service:before{content:"\e626"}
|
||||
.layui-icon-cellphone:before{content:"\e678"}
|
||||
|
||||
.layui-icon-screen-full:before{content:"\e622";}
|
||||
.layui-icon-screen-restore:before{content:"\e758";}
|
||||
.layui-icon-cols:before{content:"\e610";}
|
||||
.layui-icon-export:before{content:"\e67d";}
|
||||
.layui-icon-print:before{content:"\e66d";}
|
||||
.layui-icon-slider:before{content: "\e714";}
|
||||
.layui-icon-addition:before{content: "\e624";}
|
||||
.layui-icon-subtraction:before{content: "\e67e";}
|
||||
.layui-icon-service:before{content: "\e626";}
|
||||
.layui-icon-transfer:before{content: "\e691";}
|
||||
.layui-icon-print:before{content:"\e66d"}
|
||||
.layui-icon-cols:before{content:"\e610"}
|
||||
.layui-icon-wifi:before{content:"\e7e0"}
|
||||
.layui-icon-export:before{content:"\e67d"}
|
||||
.layui-icon-rss:before{content:"\e808"}
|
||||
.layui-icon-slider:before{content:"\e714"}
|
||||
.layui-icon-email:before{content:"\e618"}
|
||||
.layui-icon-subtraction:before{content:"\e67e"}
|
||||
.layui-icon-mike:before{content:"\e6dc"}
|
||||
.layui-icon-light:before{content:"\e748"}
|
||||
.layui-icon-gift:before{content:"\e627"}
|
||||
.layui-icon-mute:before{content:"\e685"}
|
||||
.layui-icon-reduce-circle:before{content:"\e616"}
|
||||
.layui-icon-music:before{content:"\e690"}
|
||||
|
||||
/* 基本布局 */
|
||||
.layui-main{position: relative; width: 1140px; margin: 0 auto;}
|
||||
@ -390,28 +412,43 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
.layui-col-lg-offset12{margin-left: 100%;}
|
||||
}
|
||||
|
||||
/* 列间隔 */.layui-col-space1{margin: -0.5px;}
|
||||
/* 列间隔 */
|
||||
.layui-col-space1{margin: -0.5px;}
|
||||
.layui-col-space1>*{padding: 0.5px;}
|
||||
.layui-col-space3{margin: -1.5px;}
|
||||
.layui-col-space3>*{padding: 1.5px;}
|
||||
.layui-col-space2{margin: -1px;}
|
||||
.layui-col-space2>*{padding: 1px;}
|
||||
.layui-col-space4{margin: -2px;}
|
||||
.layui-col-space4>*{padding: 2px;}
|
||||
.layui-col-space5{margin: -2.5px;}
|
||||
.layui-col-space5>*{padding: 2.5px;}
|
||||
.layui-col-space8{margin: -3.5px;}
|
||||
.layui-col-space8>*{padding: 3.5px;}
|
||||
.layui-col-space6{margin: -3px;}
|
||||
.layui-col-space6>*{padding: 3px;}
|
||||
.layui-col-space8{margin: -4px;}
|
||||
.layui-col-space8>*{padding: 4px;}
|
||||
.layui-col-space10{margin: -5px;}
|
||||
.layui-col-space10>*{padding: 5px;}
|
||||
.layui-col-space12{margin: -6px;}
|
||||
.layui-col-space12>*{padding: 6px;}
|
||||
.layui-col-space14{margin: -7px;}
|
||||
.layui-col-space14>*{padding: 7px;}
|
||||
.layui-col-space15{margin: -7.5px;}
|
||||
.layui-col-space15>*{padding: 7.5px;}
|
||||
.layui-col-space16{margin: -8px;}
|
||||
.layui-col-space16>*{padding: 8px;}
|
||||
.layui-col-space18{margin: -9px;}
|
||||
.layui-col-space18>*{padding: 9px;}
|
||||
.layui-col-space20{margin: -10px;}
|
||||
.layui-col-space20>*{padding: 10px;}
|
||||
.layui-col-space22{margin: -11px;}
|
||||
.layui-col-space22>*{padding: 11px;}
|
||||
.layui-col-space24{margin: -12px;}
|
||||
.layui-col-space24>*{padding: 12px;}
|
||||
.layui-col-space25{margin: -12.5px;}
|
||||
.layui-col-space25>*{padding: 12.5px;}
|
||||
.layui-col-space26{margin: -13px;}
|
||||
.layui-col-space26>*{padding: 13px;}
|
||||
.layui-col-space28{margin: -14px;}
|
||||
.layui-col-space28>*{padding: 14px;}
|
||||
.layui-col-space30{margin: -15px;}
|
||||
.layui-col-space30>*{padding: 15px;}
|
||||
|
||||
|
Binary file not shown.
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 277 KiB After Width: | Height: | Size: 299 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -77,7 +77,7 @@ layui.define('jquery', function(exports){
|
||||
var othis = $(this), top = othis.scrollTop();
|
||||
|
||||
if(timer) clearTimeout(timer);
|
||||
if(isOver) return;
|
||||
if(isOver || !elem.width()) return; //如果已经结束,或者元素处于隐藏状态,则不执行滚动加载
|
||||
|
||||
timer = setTimeout(function(){
|
||||
//计算滚动所在容器的可视高度
|
||||
@ -94,6 +94,7 @@ layui.define('jquery', function(exports){
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
|
||||
return that;
|
||||
};
|
||||
|
||||
|
@ -443,7 +443,7 @@ layui.define('layer', function(exports){
|
||||
,'<div class="'+ TITLE +'">'
|
||||
,('<input type="text" placeholder="'+ placeholder +'" '
|
||||
+('value="'+ (value ? selected.html() : '') +'"') //默认值
|
||||
+(isSearch ? '' : ' readonly') //是否开启搜索
|
||||
+((!disabled && isSearch) ? '' : ' readonly') //是否开启搜索
|
||||
+' class="layui-input'
|
||||
+(isSearch ? '' : ' layui-unselect')
|
||||
+ (disabled ? (' ' + DISABLED) : '') +'">') //禁用状态
|
||||
|
@ -262,10 +262,11 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
|
||||
//响应数据的自定义格式
|
||||
options.response = $.extend({
|
||||
statusName: 'code'
|
||||
,statusCode: 0
|
||||
,msgName: 'msg'
|
||||
,dataName: 'data'
|
||||
statusName: 'code' //规定数据状态的字段名称
|
||||
,statusCode: 0 //规定成功的状态码
|
||||
,msgName: 'msg' //规定状态信息的字段名称
|
||||
,dataName: 'data' //规定数据总数的字段名称
|
||||
,totalRowName: 'totalRow' //规定数据统计的字段名称
|
||||
,countName: 'count'
|
||||
}, options.response);
|
||||
|
||||
@ -738,6 +739,11 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
res[response.dataName] = options.data.concat().splice(startLimit, options.limit);
|
||||
res[response.countName] = options.data.length;
|
||||
|
||||
//记录合计行数据
|
||||
if(typeof options.totalRow === 'object'){
|
||||
res[response.totalRowName] = $.extend({}, options.totalRow);
|
||||
}
|
||||
|
||||
that.renderData(res, curr, res[response.countName]), sort();
|
||||
that.setColsWidth();
|
||||
typeof options.done === 'function' && options.done(res, curr, res[response.countName]);
|
||||
@ -755,7 +761,8 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
Class.prototype.renderData = function(res, curr, count, sort){
|
||||
var that = this
|
||||
,options = that.config
|
||||
,data = res[options.response.dataName] || []
|
||||
,data = res[options.response.dataName] || [] //列表数据
|
||||
,totalRowData = res[options.response.totalRowName] //合计行数据
|
||||
,trs = []
|
||||
,trs_fixed = []
|
||||
,trs_fixed_r = []
|
||||
@ -893,7 +900,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
}
|
||||
|
||||
render(); //渲染数据
|
||||
that.renderTotal(data); //数据合计
|
||||
that.renderTotal(data, totalRowData); //数据合计
|
||||
|
||||
//同步分页状态
|
||||
if(options.page){
|
||||
@ -923,7 +930,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
};
|
||||
|
||||
//数据合计行
|
||||
Class.prototype.renderTotal = function(data){
|
||||
Class.prototype.renderTotal = function(data, totalRowData){
|
||||
var that = this
|
||||
,options = that.config
|
||||
,totalNums = {};
|
||||
@ -958,7 +965,12 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
tplData[field] = thisTotalNum;
|
||||
thisTotalNum = parseTempData(item3, thisTotalNum, tplData);
|
||||
|
||||
//如果直接传入了合计行数据,则不输出自动计算的结果
|
||||
if(totalRowData){
|
||||
return totalRowData[item3.field] || text;
|
||||
} else {
|
||||
return item3.totalRow ? (thisTotalNum || text) : text;
|
||||
}
|
||||
}()
|
||||
,td = ['<td data-field="'+ field +'" data-key="'+ options.index + '-'+ item3.key +'" '+ function(){
|
||||
var attr = [];
|
||||
|
@ -205,9 +205,9 @@ layui.define('layer' , function(exports){
|
||||
});
|
||||
|
||||
//提交文件
|
||||
$.ajax({
|
||||
var opts = {
|
||||
url: options.url
|
||||
,type: 'post'
|
||||
,type: 'post' //统一采用 post 上传
|
||||
,data: formData
|
||||
,contentType: false
|
||||
,processData: false
|
||||
@ -226,19 +226,22 @@ layui.define('layer' , function(exports){
|
||||
error(index);
|
||||
allDone();
|
||||
}
|
||||
,xhr: function(){
|
||||
var xhr = new XMLHttpRequest();
|
||||
};
|
||||
//监听进度条
|
||||
if(typeof options.progress === 'function'){
|
||||
opts.xhr = function(){
|
||||
var xhr = $.ajaxSettings.xhr();
|
||||
//监听上传进度
|
||||
xhr.upload.addEventListener("progress", function (e) {
|
||||
if(e.lengthComputable) {
|
||||
var percent = Math.floor((e.loaded/e.total)* 100); //百分比
|
||||
typeof options.progress === 'function' && options.progress(percent, e);
|
||||
options.progress(percent, options.item[0], e);
|
||||
}
|
||||
});
|
||||
return xhr;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
$.ajax(opts);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ layui.define('jquery', function(exports){
|
||||
,stamp = new Date().getTime() - new Date(time).getTime();
|
||||
|
||||
//返回具体日期
|
||||
if(stamp > 1000*60*60*24*8){
|
||||
if(stamp > 1000*60*60*24*31){
|
||||
stamp = new Date(time);
|
||||
arr[0][0] = that.digit(stamp.getFullYear(), 4);
|
||||
arr[0][1] = that.digit(stamp.getMonth() + 1);
|
||||
@ -120,7 +120,7 @@ layui.define('jquery', function(exports){
|
||||
return ((stamp/1000/60/60/24)|0) + '天前';
|
||||
} else if(stamp >= 1000*60*60){
|
||||
return ((stamp/1000/60/60)|0) + '小时前';
|
||||
} else if(stamp >= 1000*60*2){ //2分钟以内为:刚刚
|
||||
} else if(stamp >= 1000*60*3){ //3分钟以内为:刚刚
|
||||
return ((stamp/1000/60)|0) + '分钟前';
|
||||
} else if(stamp < 0){
|
||||
return '未来';
|
||||
@ -174,12 +174,27 @@ layui.define('jquery', function(exports){
|
||||
|
||||
//批量事件
|
||||
,event: function(attr, obj, eventType){
|
||||
var _body = $('body');
|
||||
eventType = eventType || 'click';
|
||||
|
||||
//记录事件回调集合
|
||||
obj = util.event[attr] = $.extend(true, util.event[attr], obj) || {};
|
||||
$('body').on(eventType || 'click', '*['+ attr +']', function(){
|
||||
|
||||
//清除委托事件
|
||||
util.event.UTIL_EVENT_CALLBACK = util.event.UTIL_EVENT_CALLBACK || {};
|
||||
_body.off(eventType, '*['+ attr +']', util.event.UTIL_EVENT_CALLBACK[attr])
|
||||
|
||||
//绑定委托事件
|
||||
util.event.UTIL_EVENT_CALLBACK[attr] = function(){
|
||||
var othis = $(this)
|
||||
,key = othis.attr(attr);
|
||||
obj[key] && obj[key].call(this, othis);
|
||||
});
|
||||
(typeof obj[key] === 'function') && obj[key].call(this, othis);
|
||||
};
|
||||
|
||||
//清除旧事件,绑定新事件
|
||||
_body.on(eventType, '*['+ attr +']', util.event.UTIL_EVENT_CALLBACK[attr]);
|
||||
|
||||
return obj;
|
||||
}
|
||||
};
|
||||
|
||||
|
84
src/layui.js
84
src/layui.js
@ -1,8 +1,8 @@
|
||||
/*!
|
||||
|
||||
@Title: layui
|
||||
@Name: layui
|
||||
@Description:经典模块化前端 UI 框架
|
||||
@Site: www.layui.com
|
||||
@Homepage: www.layui.com
|
||||
@Author: 贤心
|
||||
@License:MIT
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
}
|
||||
|
||||
,Layui = function(){
|
||||
this.v = '2.5.5'; //版本号
|
||||
this.v = '2.5.6'; //版本号
|
||||
}
|
||||
|
||||
//获取layui所在目录
|
||||
@ -115,7 +115,7 @@
|
||||
|
||||
apps = typeof apps === 'string' ? [apps] : apps;
|
||||
|
||||
//如果页面已经存在jQuery1.7+库且所定义的模块依赖jQuery,则不加载内部jquery模块
|
||||
//如果页面已经存在 jQuery 1.7+ 库且所定义的模块依赖 jQuery,则不加载内部 jquery 模块
|
||||
if(window.jQuery && jQuery.fn.on){
|
||||
that.each(apps, function(index, item){
|
||||
if(item === 'jquery'){
|
||||
@ -163,20 +163,26 @@
|
||||
return onCallback(), that;
|
||||
}
|
||||
|
||||
//首次加载模块
|
||||
if(!config.modules[item]){
|
||||
var node = doc.createElement('script')
|
||||
|
||||
//获取加载的模块 URL
|
||||
//如果是内置模块,则按照 dir 参数拼接模块路径
|
||||
//如果是扩展模块,则判断模块路径值是否为 {/} 开头,
|
||||
//如果路径值是 {/} 开头,则模块路径即为后面紧跟的字符。
|
||||
//否则,则按照 base 参数拼接模块路径
|
||||
,url = ( modules[item] ? (dir + 'lay/')
|
||||
var url = ( modules[item] ? (dir + 'lay/')
|
||||
: (/^\{\/\}/.test(that.modules[item]) ? '' : (config.base || ''))
|
||||
) + (that.modules[item] || item) + '.js';
|
||||
|
||||
url = url.replace(/^\{\/\}/, '');
|
||||
|
||||
//如果扩展模块(即:非内置模块)对象已经存在,则不必再加载
|
||||
if(!config.modules[item] && layui[item]){
|
||||
config.modules[item] = url; //并记录起该扩展模块的 url
|
||||
}
|
||||
|
||||
//首次加载模块
|
||||
if(!config.modules[item]){
|
||||
var node = doc.createElement('script');
|
||||
|
||||
node.async = true;
|
||||
node.charset = 'utf-8';
|
||||
node.src = url + function(){
|
||||
@ -323,7 +329,7 @@
|
||||
return that;
|
||||
};
|
||||
|
||||
//路由解析
|
||||
// location.hash 路由解析
|
||||
Layui.prototype.router = function(hash){
|
||||
var that = this
|
||||
,hash = hash || location.hash
|
||||
@ -338,7 +344,7 @@
|
||||
data.href = '/' + hash;
|
||||
hash = hash.replace(/([^#])(#.*$)/, '$1').split('/') || [];
|
||||
|
||||
//提取Hash结构
|
||||
//提取 Hash 结构
|
||||
that.each(hash, function(index, item){
|
||||
/^\w+=/.test(item) ? function(){
|
||||
item = item.split('=');
|
||||
@ -349,6 +355,61 @@
|
||||
return data;
|
||||
};
|
||||
|
||||
//URL 解析
|
||||
Layui.prototype.url = function(href){
|
||||
var that = this
|
||||
,data = {
|
||||
//提取 url 路径
|
||||
pathname: function(){
|
||||
var pathname = href
|
||||
? function(){
|
||||
var pathUrl = (href.match(/\.[^.]+?\/.+/) || [])[0] || '';
|
||||
return pathUrl.replace(/^[^\/]+/, '').replace(/\?.+/, '');
|
||||
}()
|
||||
: location.pathname;
|
||||
return pathname.replace(/^\//, '').split('/');
|
||||
}()
|
||||
|
||||
//提取 url 参数
|
||||
,search: function(){
|
||||
var obj = {}
|
||||
,search = (href
|
||||
? ((href.match(/\?.+/) || [])[0] || '')
|
||||
: location.search
|
||||
).replace(/^\?+/, '').split('&'); //去除 ?,按 & 分割参数
|
||||
|
||||
//遍历分割后的参数
|
||||
that.each(search, function(index, item){
|
||||
var _index = item.indexOf('=')
|
||||
,key = function(){ //提取 key
|
||||
if(_index < 0){
|
||||
return item.substr(0, item.length);
|
||||
} else if(_index === 0){
|
||||
return false;
|
||||
} else {
|
||||
return item.substr(0, _index);
|
||||
}
|
||||
}();
|
||||
//提取 value
|
||||
if(key){
|
||||
obj[key] = _index > 0 ? item.substr(_index + 1) : null;
|
||||
}
|
||||
});
|
||||
|
||||
return obj;
|
||||
}()
|
||||
|
||||
//提取 Hash
|
||||
,hash: that.router(function(){
|
||||
return href
|
||||
? ((href.match(/#.+/) || [])[0] || '')
|
||||
: location.hash;
|
||||
}())
|
||||
};
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
//本地持久性存储
|
||||
Layui.prototype.data = function(table, settings, storage){
|
||||
table = table || 'layui';
|
||||
@ -423,6 +484,7 @@
|
||||
//移动设备
|
||||
result.android = /android/.test(agent);
|
||||
result.ios = result.os === 'ios';
|
||||
result.mobile = (result.android || result.ios) ? true : false;
|
||||
|
||||
return result;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user