update
This commit is contained in:
@@ -144,16 +144,15 @@ html #layuicss-layer{display: none; position: absolute; width: 1989px;}
|
||||
.layui-layer-tabmain .layui-layer-tabli.layui-this{display: block;}
|
||||
|
||||
/* photo模式 */
|
||||
.layui-layer-photos{-webkit-animation-duration: .8s; animation-duration: .8s;}
|
||||
.layui-layer-photos{background: none; box-shadow: none;}
|
||||
.layui-layer-photos .layui-layer-content{overflow:hidden; text-align: center;}
|
||||
.layui-layer-photos .layui-layer-phimg img{position: relative; width:100%; display: inline-block; *display:inline; *zoom:1; vertical-align:top;}
|
||||
.layui-layer-imguide,.layui-layer-imgbar{display:none;}
|
||||
.layui-layer-imgprev, .layui-layer-imgnext{position:absolute; top:50%; width:27px; _width:44px; height:44px; margin-top:-22px; outline:none;blr:expression(this.onFocus=this.blur());}
|
||||
.layui-layer-imgprev{left:10px; background-position:-5px -5px; _background-position:-70px -5px;}
|
||||
.layui-layer-imgprev, .layui-layer-imgnext{position: fixed; top: 50%; width: 27px; _width: 44px; height: 44px; margin-top:-22px; outline:none;blr:expression(this.onFocus=this.blur());}
|
||||
.layui-layer-imgprev{left: 30px; background-position:-5px -5px; _background-position:-70px -5px;}
|
||||
.layui-layer-imgprev:hover{background-position:-33px -5px; _background-position:-120px -5px;}
|
||||
.layui-layer-imgnext{right:10px; _right:8px; background-position:-5px -50px; _background-position:-70px -50px;}
|
||||
.layui-layer-imgnext:hover{background-position:-33px -50px; _background-position:-120px -50px;}
|
||||
.layui-layer-imgbar{position:absolute; left:0; bottom:0; width:100%; height:32px; line-height:32px; background-color:rgba(0,0,0,.8); background-color:#000\9; filter:Alpha(opacity=80); color:#fff; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; font-size:0;}
|
||||
.layui-layer-imgnext{right: 30px; _right:8px; background-position:-5px -50px; _background-position:-70px -50px;}
|
||||
.layui-layer-imgnext:hover{background-position: -33px -50px; _background-position: -120px -50px;}
|
||||
.layui-layer-imgbar{position: fixed; left:0; right: 0; bottom:0; width:100%; height: 40px; line-height: 40px; background-color:#000\9; filter:Alpha(opacity=60); background-color: rgba(2,0,0,.35); color: #fff; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; font-size:0;}
|
||||
.layui-layer-imgtit{/*position:absolute; left:20px;*/}
|
||||
.layui-layer-imgtit *{display:inline-block; *display:inline; *zoom:1; vertical-align:top; font-size:12px;}
|
||||
.layui-layer-imgtit a{max-width:65%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; color:#fff;}
|
||||
|
||||
48
src/layui.js
48
src/layui.js
@@ -17,7 +17,7 @@
|
||||
}
|
||||
|
||||
,Layui = function(){
|
||||
this.v = '2.6.4'; //版本号
|
||||
this.v = '2.6.5'; //版本号
|
||||
}
|
||||
|
||||
//获取layui所在目录
|
||||
@@ -34,7 +34,8 @@
|
||||
}
|
||||
return src || js[last].src;
|
||||
}();
|
||||
return jsPath.substring(0, jsPath.lastIndexOf('/') + 1);
|
||||
|
||||
return config.dir = jsPath.substring(0, jsPath.lastIndexOf('/') + 1);
|
||||
}()
|
||||
|
||||
//异常提示
|
||||
@@ -239,13 +240,14 @@
|
||||
//css外部加载器
|
||||
Layui.prototype.link = function(href, fn, cssname){
|
||||
var that = this
|
||||
,link = doc.createElement('link')
|
||||
,head = doc.getElementsByTagName('head')[0];
|
||||
,head = doc.getElementsByTagName('head')[0]
|
||||
,link = doc.createElement('link');
|
||||
|
||||
if(typeof fn === 'string') cssname = fn;
|
||||
|
||||
var app = (cssname || href).replace(/\.|\//g, '')
|
||||
,id = link.id = 'layuicss-'+ app
|
||||
,STAUTS_NAME = 'creating'
|
||||
,timeout = 0;
|
||||
|
||||
link.rel = 'stylesheet';
|
||||
@@ -255,10 +257,35 @@
|
||||
if(!doc.getElementById(id)){
|
||||
head.appendChild(link);
|
||||
}
|
||||
|
||||
|
||||
if(typeof fn !== 'function') return that;
|
||||
|
||||
//轮询 css 是否加载完毕
|
||||
(function poll(status) {
|
||||
var delay = 100
|
||||
,getLinkElem = doc.getElementById(id); //获取动态插入的 link 元素
|
||||
|
||||
//如果轮询超过指定秒数,则视为请求文件失败或 css 文件不符合规范
|
||||
if(++timeout > config.timeout * 1000 / delay){
|
||||
return error(href + ' timeout');
|
||||
};
|
||||
|
||||
//css 加载就绪
|
||||
if(parseInt(that.getStyle(getLinkElem, 'width')) === 1989){
|
||||
//如果参数来自于初始轮询(即未加载就绪时的),则移除 link 标签状态
|
||||
if(status === STAUTS_NAME) getLinkElem.removeAttribute('lay-status');
|
||||
//如果 link 标签的状态仍为「创建中」,则继续进入轮询,直到状态改变,则执行回调
|
||||
getLinkElem.getAttribute('lay-status') === STAUTS_NAME ? setTimeout(poll, delay) : fn();
|
||||
} else {
|
||||
getLinkElem.setAttribute('lay-status', STAUTS_NAME);
|
||||
setTimeout(function(){
|
||||
poll(STAUTS_NAME);
|
||||
}, delay);
|
||||
}
|
||||
}());
|
||||
|
||||
//轮询css是否加载完毕
|
||||
/*
|
||||
(function poll() {
|
||||
if(++timeout > config.timeout * 1000 / 100){
|
||||
return error(href + ' timeout');
|
||||
@@ -267,10 +294,16 @@
|
||||
fn();
|
||||
}() : setTimeout(poll, 100);
|
||||
}());
|
||||
*/
|
||||
|
||||
return that;
|
||||
};
|
||||
|
||||
//css 内部加载器
|
||||
Layui.prototype.addcss = function(firename, fn, cssname){
|
||||
return layui.link(config.dir + 'css/' + firename, fn, cssname);
|
||||
};
|
||||
|
||||
//存储模块的回调
|
||||
config.callback = {};
|
||||
|
||||
@@ -283,11 +316,6 @@
|
||||
}
|
||||
};
|
||||
|
||||
//css内部加载器
|
||||
Layui.prototype.addcss = function(firename, fn, cssname){
|
||||
return layui.link(config.dir + 'css/' + firename, fn, cssname);
|
||||
};
|
||||
|
||||
//图片预加载
|
||||
Layui.prototype.img = function(url, callback, error) {
|
||||
var img = new Image();
|
||||
|
||||
@@ -56,5 +56,5 @@ layui.define('jquery', function(exports){
|
||||
});
|
||||
|
||||
});
|
||||
}).addcss('modules/code.css?v=1', 'skincodecss');
|
||||
}).addcss('modules/code.css?v=2', 'skincodecss');
|
||||
|
||||
|
||||
@@ -116,20 +116,22 @@ layui.define('layer', function(exports){
|
||||
,field = {}
|
||||
,fieldElem = itemForm.find('input,select,textarea') //获取所有表单域
|
||||
|
||||
layui.each(fieldElem, function(_, item){
|
||||
item.name = (item.name || '').replace(/^\s*|\s*&/, '');
|
||||
layui.each(fieldElem, function(_, item){
|
||||
var othis = $(this)
|
||||
,init_name; //初始 name
|
||||
|
||||
item.name = (item.name || '').replace(/^\s*|\s*&/, '');
|
||||
if(!item.name) return;
|
||||
|
||||
//用于支持数组 name
|
||||
if(/^.*\[\]$/.test(item.name)){
|
||||
var key = item.name.match(/^(.*)\[\]$/g)[0];
|
||||
nameIndex[key] = nameIndex[key] | 0;
|
||||
item.name = item.name.replace(/^(.*)\[\]$/, '$1['+ (nameIndex[key]++) +']');
|
||||
init_name = item.name.replace(/^(.*)\[\]$/, '$1['+ (nameIndex[key]++) +']');
|
||||
}
|
||||
|
||||
if(/^checkbox|radio$/.test(item.type) && !item.checked) return;
|
||||
field[item.name] = item.value;
|
||||
if(/^checkbox|radio$/.test(item.type) && !item.checked) return; //复选框和单选框未选中,不记录字段
|
||||
field[init_name || item.name] = item.value;
|
||||
});
|
||||
|
||||
return field;
|
||||
|
||||
@@ -136,10 +136,17 @@
|
||||
|
||||
//载入 CSS 依赖
|
||||
lay.link = function(href, fn, cssname){
|
||||
var head = document.getElementsByTagName("head")[0], link = document.createElement('link');
|
||||
var head = document.getElementsByTagName("head")[0]
|
||||
,link = document.createElement('link');
|
||||
|
||||
if(typeof fn === 'string') cssname = fn;
|
||||
|
||||
var app = (cssname || href).replace(/\.|\//g, '');
|
||||
var id = 'layuicss-'+ app, timeout = 0;
|
||||
var id = 'layuicss-'+ app
|
||||
,STAUTS_NAME = 'creating'
|
||||
,timeout = 0;
|
||||
|
||||
|
||||
|
||||
link.rel = 'stylesheet';
|
||||
link.href = href;
|
||||
@@ -148,15 +155,31 @@
|
||||
if(!document.getElementById(id)){
|
||||
head.appendChild(link);
|
||||
}
|
||||
|
||||
|
||||
if(typeof fn !== 'function') return;
|
||||
|
||||
//轮询css是否加载完毕
|
||||
(function poll() {
|
||||
if(++timeout > 8 * 1000 / 100){
|
||||
return window.console && console.error(app + '.css: Invalid');
|
||||
|
||||
//轮询 css 是否加载完毕
|
||||
(function poll(status) {
|
||||
var delay = 100
|
||||
,getLinkElem = document.getElementById(id); //获取动态插入的 link 元素
|
||||
|
||||
//如果轮询超过指定秒数,则视为请求文件失败或 css 文件不符合规范
|
||||
if(++timeout > 10 * 1000 / delay){
|
||||
return window.console && console.error(app +'.css: Invalid');
|
||||
};
|
||||
parseInt(lay.getStyle(document.getElementById(id), 'width')) === 1989 ? fn() : setTimeout(poll, 100);
|
||||
|
||||
//css 加载就绪
|
||||
if(parseInt(lay.getStyle(getLinkElem, 'width')) === 1989){
|
||||
//如果参数来自于初始轮询(即未加载就绪时的),则移除 link 标签状态
|
||||
if(status === STAUTS_NAME) getLinkElem.removeAttribute('lay-status');
|
||||
//如果 link 标签的状态仍为「创建中」,则继续进入轮询,直到状态改变,则执行回调
|
||||
getLinkElem.getAttribute('lay-status') === STAUTS_NAME ? setTimeout(poll, delay) : fn();
|
||||
} else {
|
||||
getLinkElem.setAttribute('lay-status', STAUTS_NAME);
|
||||
setTimeout(function(){
|
||||
poll(STAUTS_NAME);
|
||||
}, delay);
|
||||
}
|
||||
}());
|
||||
};
|
||||
|
||||
|
||||
@@ -39,14 +39,18 @@ var isLayui = window.layui && layui.define, $, win, ready = {
|
||||
|
||||
//载入 CSS 依赖
|
||||
link: function(href, fn, cssname){
|
||||
|
||||
//未设置路径,则不主动加载css
|
||||
if(!layer.path) return;
|
||||
|
||||
var head = document.getElementsByTagName("head")[0], link = document.createElement('link');
|
||||
var head = document.getElementsByTagName("head")[0]
|
||||
,link = document.createElement('link');
|
||||
|
||||
if(typeof fn === 'string') cssname = fn;
|
||||
|
||||
var app = (cssname || href).replace(/\.|\//g, '');
|
||||
var id = 'layuicss-'+ app, timeout = 0;
|
||||
var id = 'layuicss-'+ app
|
||||
,STAUTS_NAME = 'creating'
|
||||
,timeout = 0;
|
||||
|
||||
link.rel = 'stylesheet';
|
||||
link.href = layer.path + href;
|
||||
@@ -55,22 +59,41 @@ var isLayui = window.layui && layui.define, $, win, ready = {
|
||||
if(!document.getElementById(id)){
|
||||
head.appendChild(link);
|
||||
}
|
||||
|
||||
|
||||
if(typeof fn !== 'function') return;
|
||||
|
||||
//轮询css是否加载完毕
|
||||
(function poll() {
|
||||
if(++timeout > 8 * 1000 / 100){
|
||||
return window.console && console.error('layer.css: Invalid');
|
||||
|
||||
//轮询 css 是否加载完毕
|
||||
(function poll(status) {
|
||||
var delay = 100
|
||||
,getLinkElem = document.getElementById(id); //获取动态插入的 link 元素
|
||||
|
||||
//如果轮询超过指定秒数,则视为请求文件失败或 css 文件不符合规范
|
||||
if(++timeout > 10 * 1000 / delay){
|
||||
return window.console && console.error(app +'.css: Invalid');
|
||||
};
|
||||
parseInt(ready.getStyle(document.getElementById(id), 'width')) === 1989 ? fn() : setTimeout(poll, 100);
|
||||
|
||||
//css 加载就绪
|
||||
if(parseInt(ready.getStyle(getLinkElem, 'width')) === 1989){
|
||||
//如果参数来自于初始轮询(即未加载就绪时的),则移除 link 标签状态
|
||||
if(status === STAUTS_NAME) getLinkElem.removeAttribute('lay-status');
|
||||
//如果 link 标签的状态仍为「创建中」,则继续进入轮询,直到状态改变,则执行回调
|
||||
getLinkElem.getAttribute('lay-status') === STAUTS_NAME ? setTimeout(poll, delay) : fn();
|
||||
} else {
|
||||
getLinkElem.setAttribute('lay-status', STAUTS_NAME);
|
||||
setTimeout(function(){
|
||||
poll(STAUTS_NAME);
|
||||
}, delay);
|
||||
}
|
||||
|
||||
//parseInt(ready.getStyle(document.getElementById(id), 'width')) === 1989 ? fn() : setTimeout(poll, 1000);
|
||||
}());
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
//默认内置方法。
|
||||
var layer = {
|
||||
v: '3.3.0',
|
||||
v: '3.4.0',
|
||||
ie: function(){ //ie版本
|
||||
var agent = navigator.userAgent.toLowerCase();
|
||||
return (!!window.ActiveXObject || "ActiveXObject" in window) ? (
|
||||
@@ -346,7 +369,7 @@ Class.pt.creat = function(){
|
||||
}
|
||||
|
||||
config.time <= 0 || setTimeout(function(){
|
||||
layer.close(that.index)
|
||||
layer.close(that.index);
|
||||
}, config.time);
|
||||
that.move().callback();
|
||||
|
||||
@@ -904,7 +927,7 @@ layer.title = function(name, index){
|
||||
};
|
||||
|
||||
//关闭layer总方法
|
||||
layer.close = function(index){
|
||||
layer.close = function(index, callback){
|
||||
layer.ready(function(){
|
||||
var layero = $('#'+ doms[0] + index), type = layero.attr('type'), closeAnim = 'layer-anim-close';
|
||||
if(!layero[0]) return;
|
||||
@@ -931,6 +954,7 @@ layer.close = function(index){
|
||||
}
|
||||
typeof ready.end[index] === 'function' && ready.end[index]();
|
||||
delete ready.end[index];
|
||||
typeof callback === 'function' && callback();
|
||||
};
|
||||
|
||||
if(layero.data('isOutAnim')){
|
||||
@@ -956,20 +980,26 @@ layer.close = function(index){
|
||||
};
|
||||
|
||||
//关闭所有层
|
||||
layer.closeAll = function(type){
|
||||
layer.closeAll = function(type, callback){
|
||||
if(typeof type === 'function'){
|
||||
callback = type;
|
||||
type = null;
|
||||
};
|
||||
layer.ready(function(){
|
||||
$.each($('.'+doms[0]), function(){
|
||||
var domsElem = $('.'+doms[0]);
|
||||
$.each(domsElem, function(_index){
|
||||
var othis = $(this);
|
||||
var is = type ? (othis.attr('type') === type) : 1;
|
||||
is && layer.close(othis.attr('times'));
|
||||
is && layer.close(othis.attr('times'), _index === domsElem.length - 1 ? callback : null);
|
||||
is = null;
|
||||
});
|
||||
if(domsElem.length === 0) typeof callback === 'function' && callback();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
拓展模块,layui开始合并在一起
|
||||
拓展模块,layui 开始合并在一起
|
||||
|
||||
*/
|
||||
|
||||
@@ -1097,7 +1127,7 @@ layer.photos = function(options, loop, key){
|
||||
src: othis.attr('layer-src') || othis.attr('src'),
|
||||
thumb: othis.attr('src')
|
||||
});
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
pushData();
|
||||
@@ -1105,6 +1135,7 @@ layer.photos = function(options, loop, key){
|
||||
if (data.length === 0) return;
|
||||
|
||||
loop || parent.on('click', options.img, function(){
|
||||
pushData();
|
||||
var othis = $(this), index = othis.attr('layer-index');
|
||||
layer.photos($.extend(options, {
|
||||
photos: {
|
||||
@@ -1114,8 +1145,7 @@ layer.photos = function(options, loop, key){
|
||||
},
|
||||
full: options.full
|
||||
}), true);
|
||||
pushData();
|
||||
})
|
||||
});
|
||||
|
||||
//不直接弹出
|
||||
if(!loop) return;
|
||||
@@ -1171,20 +1201,22 @@ layer.photos = function(options, loop, key){
|
||||
|
||||
//一些动作
|
||||
dict.event = function(){
|
||||
/*
|
||||
dict.bigimg.hover(function(){
|
||||
dict.imgsee.show();
|
||||
}, function(){
|
||||
dict.imgsee.hide();
|
||||
});
|
||||
*/
|
||||
|
||||
dict.bigimg.find('.layui-layer-imgprev').on('click', function(event){
|
||||
event.preventDefault();
|
||||
dict.imgprev();
|
||||
dict.imgprev(true);
|
||||
});
|
||||
|
||||
dict.bigimg.find('.layui-layer-imgnext').on('click', function(event){
|
||||
event.preventDefault();
|
||||
dict.imgnext();
|
||||
dict.imgnext(true);
|
||||
});
|
||||
|
||||
$(document).on('keyup', dict.keyup);
|
||||
@@ -1214,6 +1246,11 @@ layer.photos = function(options, loop, key){
|
||||
|
||||
loadImage(data[start].src, function(img){
|
||||
layer.close(dict.loadi);
|
||||
|
||||
//切换图片时不出现动画
|
||||
if(key) options.anim = -1;
|
||||
|
||||
//弹出图片层
|
||||
dict.index = layer.open($.extend({
|
||||
type: 1,
|
||||
id: 'layui-layer-photos',
|
||||
@@ -1243,19 +1280,24 @@ layer.photos = function(options, loop, key){
|
||||
moveType: 1,
|
||||
scrollbar: false,
|
||||
moveOut: true,
|
||||
//anim: Math.random()*5|0,
|
||||
anim: 5,
|
||||
isOutAnim: false,
|
||||
skin: 'layui-layer-photos' + skin('photos'),
|
||||
content: '<div class="layui-layer-phimg">'
|
||||
+'<img src="'+ data[start].src +'" alt="'+ (data[start].alt||'') +'" layer-pid="'+ data[start].pid +'">'
|
||||
+'<div class="layui-layer-imgsee">'
|
||||
+(data.length > 1 ? '<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>' : '')
|
||||
+'<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><a href="javascript:;">'+ (data[start].alt||'') +'</a><em>'+ dict.imgIndex +'/'+ data.length +'</em></span></div>'
|
||||
+'</div>'
|
||||
+function(){
|
||||
if(data.length > 1){
|
||||
return '<div class="layui-layer-imgsee">'
|
||||
+'<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>'
|
||||
+'<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><a href="javascript:;">'+ (data[start].alt || '') +'</a><em>'+ dict.imgIndex +' / '+ data.length +'</em></span></div>'
|
||||
+'</div>'
|
||||
}
|
||||
return '';
|
||||
}()
|
||||
+'</div>',
|
||||
success: function(layero, index){
|
||||
dict.bigimg = layero.find('.layui-layer-phimg');
|
||||
dict.imgsee = layero.find('.layui-layer-imguide,.layui-layer-imgbar');
|
||||
dict.imgsee = layero.find('.layui-layer-imgbar');
|
||||
dict.event(layero);
|
||||
options.tab && options.tab(data[start], layero);
|
||||
typeof success === 'function' && success(layero);
|
||||
@@ -1290,7 +1332,7 @@ ready.run = function(_$){
|
||||
//加载方式
|
||||
window.layui && layui.define ? (
|
||||
layer.ready()
|
||||
,layui.define('jquery', function(exports){ //layui加载
|
||||
,layui.define('jquery', function(exports){ //layui 加载
|
||||
layer.path = layui.cache.dir;
|
||||
ready.run(layui.$);
|
||||
|
||||
@@ -1299,13 +1341,16 @@ window.layui && layui.define ? (
|
||||
exports('layer', layer);
|
||||
})
|
||||
) : (
|
||||
(typeof define === 'function' && define.amd) ? define(['jquery'], function(){ //requirejs加载
|
||||
(typeof define === 'function' && define.amd) ? define(['jquery'], function(){ //requirejs 加载
|
||||
ready.run(window.jQuery);
|
||||
return layer;
|
||||
}) : function(){ //普通script标签加载
|
||||
ready.run(window.jQuery);
|
||||
}) : function(){ //普通 script 标签加载
|
||||
layer.ready();
|
||||
ready.run(window.jQuery);
|
||||
}()
|
||||
);
|
||||
|
||||
}(window);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ layui.define(function(exports){
|
||||
//匹配JS规则内容
|
||||
.replace(/(?="|')/g, '\\').replace(tool.query(), function(str){
|
||||
str = str.replace(jss, '').replace(jsse, '');
|
||||
return '";' + str.replace(/\\/g, '') + ';view+="';
|
||||
return '";' + str.replace(/\\(.)/g, '$1') + ';view+="';
|
||||
})
|
||||
|
||||
//匹配普通字段
|
||||
@@ -81,7 +81,7 @@ layui.define(function(exports){
|
||||
str = str.replace(/^=/, '');
|
||||
start = '"+_escape_(';
|
||||
}
|
||||
return start + str.replace(/\\/g, '') + ')+"';
|
||||
return start + str.replace(/\\(.)/g, '$1') + ')+"';
|
||||
});
|
||||
|
||||
tpl = '"use strict";var view = "' + tpl + '";return view;';
|
||||
|
||||
@@ -777,7 +777,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
var thisCheckedRowIndex;
|
||||
if(!sort && that.sortKey){
|
||||
return that.sort(that.sortKey.field, that.sortKey.sort, true);
|
||||
}
|
||||
}
|
||||
layui.each(data, function(i1, item1){
|
||||
var tds = [], tds_fixed = [], tds_fixed_r = []
|
||||
,numbers = i1 + options.limit*(curr - 1) + 1; //序号
|
||||
@@ -795,7 +795,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
|
||||
if(content === undefined || content === null) content = '';
|
||||
if(item3.colGroup) return;
|
||||
|
||||
|
||||
//td内容
|
||||
var td = ['<td data-field="'+ field +'" data-key="'+ key +'" '+ function(){ //追加各种属性
|
||||
var attr = [];
|
||||
@@ -967,17 +967,16 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
var content = function(){
|
||||
var text = item3.totalRowText || ''
|
||||
,thisTotalNum = parseFloat(totalNums[field]).toFixed(2)
|
||||
,tplData = {};
|
||||
,tplData = {}
|
||||
,getContent;
|
||||
|
||||
tplData[field] = thisTotalNum;
|
||||
thisTotalNum = parseTempData(item3, thisTotalNum, tplData);
|
||||
|
||||
//获取自动计算的合并内容
|
||||
getContent = item3.totalRow ? (parseTempData(item3, thisTotalNum, tplData) || text) : text;
|
||||
|
||||
//如果直接传入了合计行数据,则不输出自动计算的结果
|
||||
if(totalRowData){
|
||||
return totalRowData[item3.field] || text;
|
||||
} else {
|
||||
return item3.totalRow ? (thisTotalNum || text) : text;
|
||||
}
|
||||
return totalRowData ? (totalRowData[item3.field] || getContent) : getContent;
|
||||
}()
|
||||
,td = ['<td data-field="'+ field +'" data-key="'+ options.index + '-'+ item3.key +'" '+ function(){
|
||||
var attr = [];
|
||||
@@ -2017,7 +2016,9 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
};
|
||||
|
||||
//自动完成渲染
|
||||
table.init();
|
||||
$(function(){
|
||||
table.init();
|
||||
});
|
||||
|
||||
exports(MOD_NAME, table);
|
||||
});
|
||||
|
||||
@@ -234,7 +234,7 @@ layui.define('layer' , function(exports){
|
||||
xhr.upload.addEventListener("progress", function (e) {
|
||||
if(e.lengthComputable) {
|
||||
var percent = Math.floor((e.loaded/e.total)* 100); //百分比
|
||||
options.progress(percent, options.item[0], e);
|
||||
options.progress(percent, (options.item ? options.item[0] : options.elem[0]) , e);
|
||||
}
|
||||
});
|
||||
return xhr;
|
||||
|
||||
Reference in New Issue
Block a user