This commit is contained in:
贤心
2020-11-26 22:12:46 +08:00
parent fba6ab7cd2
commit f0f17b50b0
43 changed files with 153 additions and 80 deletions

View File

@@ -558,7 +558,7 @@ hr, .layui-timeline-item:before{background-color: #e6e6e6;}
.layui-text ul{padding: 5px 0 5px 15px;}
.layui-text ul li{margin-top: 5px; list-style-type: disc;}
.layui-text em,
.layui-word-aux{color: #999 !important; padding: 0 5px !important;}
.layui-word-aux{color: #999 !important; padding-left: 5px !important; padding-right: 5px !important;}
/*
@@ -1004,7 +1004,7 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh
.layui-nav-img{width: 30px; height: 30px; margin-right: 10px; border-radius: 50%;}
.layui-nav .layui-nav-more{content:''; width: 0; height: 0; border-style: dashed; border-color: transparent; overflow: hidden; cursor: pointer; transition: all .2s; -webkit-transition: all .2s;}
.layui-nav .layui-nav-more{position: absolute; top: 50%; right: 3px; margin-top: -3px; border-width: 6px; border-top-style: solid; border-top-color: #fff; border-top-color: rgba(255,255,255,.7);}
.layui-nav .layui-nav-more{position: absolute; top: 50%; right: 3px; margin-top: -4px; border-width: 6px; border-top-style: solid; border-top-color: #fff; border-top-color: rgba(255,255,255,.7);}
.layui-nav .layui-nav-mored,
.layui-nav-itemed > a .layui-nav-more{margin-top: -9px; border-style: dashed; border-color: transparent; border-bottom-style: solid; border-bottom-color: #fff;}
@@ -1121,7 +1121,8 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh
.layui-btn .layui-badge,
.layui-btn .layui-badge-dot{margin-left: 5px;}
.layui-nav .layui-badge,
.layui-nav .layui-badge-dot{position: absolute; top: 50%; margin: -8px 6px 0;}
.layui-nav .layui-badge-dot{position: absolute; top: 50%; margin: -5px 6px 0;}
.layui-nav .layui-badge{margin-top: -10px;}
.layui-tab-title .layui-badge,
.layui-tab-title .layui-badge-dot{left: 5px; top: -2px;}
@@ -1256,15 +1257,15 @@ body .layui-util-face .layui-layer-content{padding:0; background-color:#fff; co
.layui-slider-wrap-btn.layui-disabled:hover{transform: scale(1) !important;}
.layui-slider-tips{position: absolute; top: -42px; z-index: 66666666; white-space:nowrap; display: none; -webkit-transform: translateX(-50%); transform: translateX(-50%); color: #FFF; background: #000; border-radius: 3px; height: 25px; line-height: 25px; padding: 0 10px;}
.layui-slider-tips:after{content: ''; position: absolute; bottom: -12px; left: 50%; margin-left: -6px; width: 0; height: 0; border-width: 6px; border-style: solid; border-color: #000 transparent transparent transparent;}
.layui-slider-input{width: 70px; height: 32px; border: 1px solid #e6e6e6; border-radius: 3px; font-size: 16px; line-height: 32px; position: absolute; right: 0; top: -15px;}
.layui-slider-input-btn{display: none; position: absolute; top: 0; right: 0; width: 20px; height: 100%; border-left: 1px solid #d2d2d2;}
.layui-slider-input{width: 70px; height: 32px; border: 1px solid #e6e6e6; border-radius: 3px; font-size: 16px; line-height: 32px; position: absolute; right: 0; top: -14px;}
.layui-slider-input-btn{position: absolute; top: 0; right: 0; width: 20px; height: 100%; border-left: 1px solid #d2d2d2;}
.layui-slider-input-btn i{cursor: pointer; position: absolute; right: 0; bottom: 0; width: 20px; height: 50%; font-size: 12px; line-height: 16px; text-align: center; color: #999;}
.layui-slider-input-btn i:first-child{top: 0; border-bottom: 1px solid #d2d2d2;}
.layui-slider-input-txt{height: 100%; font-size: 14px;}
.layui-slider-input-txt input{height: 100%; border: none;}
.layui-slider-input-btn i:hover{color: #009688;}
/*垂直滑块*/
.layui-slider-vertical{width: 4px; margin-left: 34px;}
.layui-slider-vertical{width: 4px; margin-left: 33px;}
.layui-slider-vertical .layui-slider-bar{width: 4px;}
.layui-slider-vertical .layui-slider-step{top: auto; left: 0px; -webkit-transform: translateY(50%); transform: translateY(50%);}
.layui-slider-vertical .layui-slider-wrap{top: auto; left: -16px; -webkit-transform: translateY(50%); transform: translateY(50%);}

View File

@@ -662,7 +662,9 @@ layui.define('layer', function(exports){
}(), {tips: 1});
} else if(verType === 'alert') {
layer.alert(errorText, {title: '提示', shadeClose: true});
} else {
}
//如果返回的为字符或数字,则自动弹出默认提示框;否则由 verify 方法中处理提示
else if(/\bstring|number\b/.test(typeof errorText)){
layer.msg(errorText, {icon: 5, shift: 6});
}

View File

@@ -1,6 +1,6 @@
/*!
@Namelayer mobile v2.0.0 弹层组件移动版
@Namelayer mobile v2.0.0 (Web 弹层组件移动版)
@Author贤心
@Sitehttp://layer.layui.com/mobie/
@LicenseMIT

View File

@@ -71,6 +71,11 @@ layui.define('jquery',function(exports){
,style = options.theme ? ('style="color: '+ options.theme + ';"') : '';
options.elem = $(options.elem);
//最大值不能大于总长度
if(options.value > options.length){
options.value = options.length;
}
//如果没有选择半星的属性,却给了小数的数值,统一向上或向下取整
if(parseInt(options.value) !== options.value){

View File

@@ -35,6 +35,7 @@ layui.define('jquery', function(exports){
return {
setValue: function(value, index){ //设置值
options.value = value;
return that.slide('set', value, index || 0);
}
,config: options
@@ -234,12 +235,10 @@ layui.define('jquery', function(exports){
sliderAct.find('.' + SLIDER_BAR).css({"width":wrapWidth + '%', "left":minLeft + '%'});
};
var selfValue = options.min + Math.round((options.max - options.min) * offsetValue / 100);
inputValue = selfValue;
sliderTxt.children('.' + SLIDER_INPUT_TXT).children('input').val(inputValue);
sliderWrap.eq(index).data('value', selfValue);
selfValue = options.setTips ? options.setTips(selfValue) : selfValue;
sliderAct.find('.' + SLIDER_TIPS).html(selfValue);
sliderAct.find('.' + SLIDER_TIPS).html(options.setTips ? options.setTips(selfValue) : selfValue);
//如果开启范围选择,则返回数组值
if(options.range){
@@ -332,20 +331,12 @@ layui.define('jquery', function(exports){
e.preventDefault();
}
});
//输入框移入事件
sliderTxt.hover(function(){
var othis = $(this);
othis.children('.' + SLIDER_INPUT_BTN).fadeIn('fast');
}, function(){
var othis = $(this);
othis.children('.' + SLIDER_INPUT_BTN).fadeOut('fast');
});
//点击加减输入框
sliderTxt.children('.' + SLIDER_INPUT_BTN).children('i').each(function(index){
$(this).on('click', function(){
if(index == 1){
inputValue = sliderTxt.children('.' + SLIDER_INPUT_TXT).children('input').val();
if(index == 1){ //减
inputValue = inputValue - options.step < options.min
? options.min
: Number(inputValue) - options.step;

View File

@@ -887,11 +887,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
//显示隐藏分页栏
that.layPage[(count == 0 || (data.length === 0 && curr == 1)) ? 'addClass' : 'removeClass'](HIDE);
//排序
if(sort){
return render();
}
//如果无数据
if(data.length === 0){
that.renderForm();
return that.errorView(options.text.none);
@@ -899,6 +895,12 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
that.layFixed.removeClass(HIDE);
}
//如果执行初始排序
if(sort){
return render();
}
//正常初始化数据渲染
render(); //渲染数据
that.renderTotal(data, totalRowData); //数据合计

View File

@@ -174,7 +174,7 @@ layui.define('form', function(exports){
//遍历数据
layui.each(data, function(index, item){
var hasChild = item.children && item.children.length > 0
,packDiv = $('<div class="layui-tree-pack" '+ (item.spread ? 'style="display: block;"' : '') +'"></div>')
,packDiv = $('<div class="layui-tree-pack" '+ (item.spread ? 'style="display: block;"' : '') +'></div>')
,entryDiv = $(['<div data-id="'+ item.id +'" class="layui-tree-set'+ (item.spread ? " layui-tree-spread" : "") + (item.checked ? " layui-tree-checkedFirst" : "") +'">'
,'<div class="layui-tree-entry">'
,'<div class="layui-tree-main">'

View File

@@ -2,8 +2,6 @@
@Name: layui
@Description经典模块化前端 UI 框架
@Homepage: www.layui.com
@Author: 贤心
@LicenseMIT
*/
@@ -19,7 +17,7 @@
}
,Layui = function(){
this.v = '2.5.6'; //版本号
this.v = '2.5.7'; //版本号
}
//获取layui所在目录
@@ -363,8 +361,8 @@
pathname: function(){
var pathname = href
? function(){
var pathUrl = (href.match(/\.[^.]+?\/.+/) || [])[0] || '';
return pathUrl.replace(/^[^\/]+/, '').replace(/\?.+/, '');
var str = (href.match(/\.[^.]+?\/.+/) || [])[0] || '';
return str.replace(/^[^\/]+/, '').replace(/\?.+/, '');
}()
: location.pathname;
return pathname.replace(/^\//, '').split('/');
@@ -374,7 +372,10 @@
,search: function(){
var obj = {}
,search = (href
? ((href.match(/\?.+/) || [])[0] || '')
? function(){
var str = (href.match(/\?.+/) || [])[0] || '';
return str.replace(/\#.+/, '');
}()
: location.search
).replace(/^\?+/, '').split('&'); //去除 ?,按 & 分割参数
@@ -570,7 +571,7 @@
Layui.prototype.event = Layui.event = function(modName, events, params, fn){
var that = this
,result = null
,filter = events.match(/\((.*)\)$/)||[] //提取事件过滤器字符结构select(xxx)
,filter = (events || '').match(/\((.*)\)$/)||[] //提取事件过滤器字符结构select(xxx)
,eventName = (modName + '.'+ events).replace(filter[0], '') //获取事件名称form.select
,filterName = filter[1] || '' //获取过滤器名称,xxx
,callback = function(_, item){
@@ -578,6 +579,12 @@
res === false && result === null && (result = false);
};
//如果参数传入特定字符,则执行移除事件
if(params === 'LAYUI-EVENT-REMOVE'){
delete (that.cache.event[eventName] || {})[filterName];
return that;
}
//添加事件
if(fn){
config.event[eventName] = config.event[eventName] || {};
@@ -603,6 +610,18 @@
return result;
};
//新增模块事件
Layui.prototype.on = function(events, modName, callback){
var that = this;
return that.onevent.call(that, modName, events, callback);
}
//移除模块事件
Layui.prototype.off = function(events, modName){
var that = this;
return that.event.call(that, modName, events, 'LAYUI-EVENT-REMOVE');
};
win.layui = new Layui();