update
This commit is contained in:
@@ -62,7 +62,7 @@ layui.define('jquery', function(exports){
|
||||
,tabElem = $('.layui-tab[lay-filter='+ filter +']')
|
||||
,titElem = tabElem.children(TITLE)
|
||||
,liElem = titElem.find('>li[lay-id="'+ layid +'"]');
|
||||
call.tabClick(null, null, liElem);
|
||||
call.tabClick.call(liElem[0], null, null, liElem);
|
||||
return this;
|
||||
};
|
||||
|
||||
@@ -193,7 +193,7 @@ layui.define('jquery', function(exports){
|
||||
}
|
||||
}
|
||||
|
||||
//点击选中
|
||||
//点击选中导航菜单
|
||||
,clickThis: function(){
|
||||
var othis = $(this), parents = othis.parents(NAV_ELEM)
|
||||
,filter = parents.attr('lay-filter')
|
||||
|
||||
@@ -376,14 +376,21 @@ layui.define('layer', function(exports){
|
||||
var othis = $(this), hasRender = othis.next('.' + CLASS), disabled = this.disabled;
|
||||
|
||||
if(typeof othis.attr('lay-ignore') === 'string') return othis.show();
|
||||
hasRender[0] && hasRender.remove(); //如果已经渲染,则Rerender
|
||||
|
||||
//替代元素
|
||||
var reElem = $(['<div class="layui-unselect '+ CLASS + (radio.checked ? (' '+CLASS+'ed') : '') + (disabled ? ' layui-radio-disbaled '+DISABLED : '') +'">'
|
||||
,'<i class="layui-anim layui-icon">'+ ICON[radio.checked ? 0 : 1] +'</i>'
|
||||
,'<span>'+ (radio.title||'未命名') +'</span>'
|
||||
,'<div>'+ function(){
|
||||
var title = radio.title || '';
|
||||
if(typeof othis.next().attr('lay-radio') === 'string'){
|
||||
title = othis.next().html();
|
||||
othis.next().remove();
|
||||
}
|
||||
return title
|
||||
}() +'</div>'
|
||||
,'</div>'].join(''));
|
||||
|
||||
hasRender[0] && hasRender.remove(); //如果已经渲染,则Rerender
|
||||
|
||||
othis.after(reElem);
|
||||
events.call(this, reElem);
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
|
||||
@Name:layer v3.1.1 Web弹层组件
|
||||
@Name:layer v3.1.2 Web弹层组件
|
||||
@Author:贤心
|
||||
@Site:http://layer.layui.com
|
||||
@License:MIT
|
||||
@@ -982,8 +982,8 @@ layer.prompt = function(options, yes){
|
||||
style = 'style="width: '+ area[0] +'; height: '+ area[1] + ';"';
|
||||
delete options.area;
|
||||
}
|
||||
var prompt, content = options.formType == 2 ? '<textarea class="layui-layer-input"' + style +'>' + (options.value||'') +'</textarea>' : function(){
|
||||
return '<input type="'+ (options.formType == 1 ? 'password' : 'text') +'" class="layui-layer-input" value="'+ (options.value||'') +'">';
|
||||
var prompt, content = options.formType == 2 ? '<textarea class="layui-layer-input"' + style +'></textarea>' : function(){
|
||||
return '<input type="'+ (options.formType == 1 ? 'password' : 'text') +'" class="layui-layer-input">';
|
||||
}();
|
||||
|
||||
var success = options.success;
|
||||
@@ -997,7 +997,7 @@ layer.prompt = function(options, yes){
|
||||
,maxWidth: win.width()
|
||||
,success: function(layero){
|
||||
prompt = layero.find('.layui-layer-input');
|
||||
prompt.focus();
|
||||
prompt.val(options.value || '').focus();
|
||||
typeof success === 'function' && success(layero);
|
||||
}
|
||||
,resize: false
|
||||
|
||||
@@ -192,6 +192,9 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
|
||||
limit: 10 //每页显示的数量
|
||||
,loading: true //请求数据时,是否显示loading
|
||||
,cellMinWidth: 60 //所有单元格默认最小宽度
|
||||
,text: {
|
||||
none: '无数据'
|
||||
}
|
||||
};
|
||||
|
||||
//表格渲染
|
||||
@@ -417,10 +420,11 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
|
||||
,success: function(res){
|
||||
if(res[response.statusName] != response.statusCode){
|
||||
that.renderForm();
|
||||
return that.layMain.html('<div class="'+ NONE +'">'+ (res[response.msgName] || '返回的数据状态异常') +'</div>');
|
||||
that.layMain.html('<div class="'+ NONE +'">'+ (res[response.msgName] || '返回的数据状态异常') +'</div>');
|
||||
} else {
|
||||
that.renderData(res, curr, res[response.countName]), sort();
|
||||
options.time = (new Date().getTime() - that.startTime) + ' ms'; //耗时(接口请求+视图渲染)
|
||||
}
|
||||
that.renderData(res, curr, res[response.countName]), sort();
|
||||
options.time = (new Date().getTime() - that.startTime) + ' ms'; //耗时(接口请求+视图渲染)
|
||||
loadIndex && layer.close(loadIndex);
|
||||
typeof options.done === 'function' && options.done(res, curr, res[response.countName]);
|
||||
}
|
||||
@@ -548,8 +552,11 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
|
||||
if(item3.toolbar){
|
||||
return laytpl($(item3.toolbar).html()||'').render(tplData);
|
||||
}
|
||||
|
||||
return item3.templet ? laytpl($(item3.templet).html() || String(content)).render(tplData) : content;
|
||||
return item3.templet ? function(){
|
||||
return typeof item3.templet === 'function'
|
||||
? item3.templet(tplData)
|
||||
: laytpl($(item3.templet).html() || String(content)).render(tplData)
|
||||
}() : content;
|
||||
}()
|
||||
,'</div></td>'].join('');
|
||||
|
||||
@@ -583,6 +590,9 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
|
||||
that.key = options.id || options.index;
|
||||
table.cache[that.key] = data; //记录数据
|
||||
|
||||
//显示隐藏分页栏
|
||||
that.layPage[data.length === 0 && curr == 1 ? 'addClass' : 'removeClass'](HIDE);
|
||||
|
||||
//排序
|
||||
if(sort){
|
||||
return render();
|
||||
@@ -593,7 +603,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
|
||||
that.layFixed.remove();
|
||||
that.layMain.find('tbody').html('');
|
||||
that.layMain.find('.'+ NONE).remove();
|
||||
return that.layMain.append('<div class="'+ NONE +'">无数据</div>');
|
||||
return that.layMain.append('<div class="'+ NONE +'">'+ options.text.none +'</div>');
|
||||
}
|
||||
|
||||
render();
|
||||
|
||||
@@ -143,7 +143,7 @@ layui.define('jquery', function(exports){
|
||||
//转化为日期格式字符
|
||||
,toDateString: function(time, format){
|
||||
var that = this
|
||||
,date = new Date(parseInt(time) || new Date())
|
||||
,date = new Date(time || new Date())
|
||||
,ymd = [
|
||||
that.digit(date.getFullYear(), 4)
|
||||
,that.digit(date.getMonth() + 1)
|
||||
|
||||
Reference in New Issue
Block a user