整理部分源码
parent
f235c29fc9
commit
84a3a14e29
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,5 @@
|
||||||
@import url("../../layui/css/layui.css");
|
@import url("../../layui/css/layui.css");
|
||||||
|
@import url("../font/iconfont.css");
|
||||||
|
|
||||||
@import url("pear-module/dtree/font/dtreefont.css");
|
@import url("pear-module/dtree/font/dtreefont.css");
|
||||||
@import url("pear-module/icon/iconfont.css");
|
@import url("pear-module/icon/iconfont.css");
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 106 KiB |
|
|
@ -1,36 +1,45 @@
|
||||||
layui.define(['jquery', 'element', 'util'], function(exports) {
|
layui.define(['jquery'], function(exports) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Button component
|
||||||
|
* */
|
||||||
var MOD_NAME = 'button',
|
var MOD_NAME = 'button',
|
||||||
$ = layui.jquery,
|
$ = layui.jquery;
|
||||||
util = layui.util,
|
|
||||||
element = layui.element;
|
|
||||||
|
|
||||||
var button = function(opt) {
|
var button = function(opt) {
|
||||||
this.option = opt;
|
this.option = opt;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Button start loading
|
||||||
|
* */
|
||||||
button.prototype.load = function(opt) {
|
button.prototype.load = function(opt) {
|
||||||
//默认配置值
|
|
||||||
var option = {
|
var option = {
|
||||||
elem: opt.elem,
|
elem: opt.elem,
|
||||||
time: opt.time ? opt.time : false,
|
time: opt.time ? opt.time : false,
|
||||||
done: opt.done ? opt.done : function(){}
|
done: opt.done ? opt.done : function(){}
|
||||||
}
|
}
|
||||||
var load = $(option.elem).text();
|
var text = $(option.elem).text();
|
||||||
|
|
||||||
$(option.elem).html("<i class='layui-anim layui-anim-rotate layui-icon layui-anim-loop layui-icon-loading'/>");
|
$(option.elem).html("<i class='layui-anim layui-anim-rotate layui-icon layui-anim-loop layui-icon-loading'/>");
|
||||||
|
|
||||||
var buttons = $(option.elem);
|
var buttons = $(option.elem);
|
||||||
if (option.time == "") {
|
|
||||||
} else {
|
if (option.time != "" || option.time !=false) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
buttons.html(load);
|
buttons.html(text);
|
||||||
option.done();
|
option.done();
|
||||||
}, option.time);
|
}, option.time);
|
||||||
}
|
}
|
||||||
option.text = load;
|
option.text = text;
|
||||||
return new button(option);
|
return new button(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Button stop loaded
|
||||||
|
* */
|
||||||
button.prototype.stop = function(success) {
|
button.prototype.stop = function(success) {
|
||||||
$(this.option.elem).html(this.option.text);
|
$(this.option.elem).html(this.option.text);
|
||||||
success();
|
success();
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
layui.define(['jquery', 'element'], function(exports) {
|
layui.define(['jquery', 'element'], function(exports) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数 字 滚 动 组 件
|
||||||
|
* */
|
||||||
var MOD_NAME = 'count',
|
var MOD_NAME = 'count',
|
||||||
$ = layui.jquery,
|
$ = layui.jquery,
|
||||||
element = layui.element;
|
element = layui.element;
|
||||||
|
|
@ -12,25 +15,20 @@ layui.define(['jquery', 'element'], function(exports) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
||||||
var $this = document.getElementById(targetEle),
|
var $this = document.getElementById(targetEle),
|
||||||
time = options.time, //总时间--毫秒为单位
|
time = options.time,
|
||||||
finalNum = options.num, //要显示的真实数值
|
finalNum = options.num,
|
||||||
regulator = options.regulator, //调速器,改变regulator的数值可以调节数字改变的速度
|
regulator = options.regulator,
|
||||||
step = finalNum / (time / regulator),
|
step = finalNum / (time / regulator),
|
||||||
count = 0.00,
|
count = 0.00,
|
||||||
initial = 0;
|
initial = 0;
|
||||||
|
|
||||||
|
|
||||||
var timer = setInterval(function() {
|
var timer = setInterval(function() {
|
||||||
count = count + step;
|
count = count + step;
|
||||||
|
|
||||||
if (count >= finalNum) {
|
if (count >= finalNum) {
|
||||||
clearInterval(timer);
|
clearInterval(timer);
|
||||||
count = finalNum;
|
count = finalNum;
|
||||||
}
|
}
|
||||||
//t未发生改变的话就直接返回
|
|
||||||
//避免调用text函数,提高DOM性能
|
|
||||||
var t = count.toFixed(options.bit?options.bit:0);;
|
var t = count.toFixed(options.bit?options.bit:0);;
|
||||||
|
|
||||||
if (t == initial) return;
|
if (t == initial) return;
|
||||||
initial = t;
|
initial = t;
|
||||||
$this.innerHTML = initial;
|
$this.innerHTML = initial;
|
||||||
|
|
@ -1,14 +1,20 @@
|
||||||
layui.define(['jquery', 'element'], function(exports) {
|
layui.define(['jquery', 'element'], function(exports) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Drawer component
|
||||||
|
* */
|
||||||
var MOD_NAME = 'drawer',
|
var MOD_NAME = 'drawer',
|
||||||
$ = layui.jquery,
|
$ = layui.jquery,
|
||||||
element = layui.element;
|
element = layui.element;
|
||||||
|
|
||||||
var drawer = new function() {
|
var drawer = new function() {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* open drawer
|
||||||
|
* */
|
||||||
this.open = function(option) {
|
this.open = function(option) {
|
||||||
var _right = new mSlider({
|
var obj = new mSlider({
|
||||||
dom: option.dom,
|
dom: option.dom,
|
||||||
direction: option.direction,
|
direction: option.direction,
|
||||||
distance: option.distance,
|
distance: option.distance,
|
||||||
|
|
@ -16,15 +22,17 @@ layui.define(['jquery', 'element'], function(exports) {
|
||||||
maskClose:option.maskClose,
|
maskClose:option.maskClose,
|
||||||
callback:option.success
|
callback:option.success
|
||||||
});
|
});
|
||||||
_right.open();
|
obj.open();
|
||||||
|
return obj;
|
||||||
return _right;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
exports(MOD_NAME,drawer);
|
exports(MOD_NAME,drawer);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 源码
|
||||||
|
* */
|
||||||
(function(b, c) {
|
(function(b, c) {
|
||||||
function a(d) {
|
function a(d) {
|
||||||
this.opts = {
|
this.opts = {
|
||||||
|
|
@ -20,7 +20,6 @@ layui.define(['table', 'jquery', 'element'], function (exports) {
|
||||||
done:opt.done ? opt.done: function(){ console.log("菜单渲染成功");}
|
done:opt.done ? opt.done: function(){ console.log("菜单渲染成功");}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
createFrameHTML(option);
|
createFrameHTML(option);
|
||||||
|
|
||||||
$("#"+option.elem).width(option.width);
|
$("#"+option.elem).width(option.width);
|
||||||
|
|
@ -236,11 +236,9 @@ layui.define(['laypage', 'form'], function (exports) {
|
||||||
'</div>';
|
'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$('#' + ICON_BODY).find('.layui-anim').find('.' + LIST_BOX).html('').append(listHtml).append(pageHtml);
|
$('#' + ICON_BODY).find('.layui-anim').find('.' + LIST_BOX).html('').append(listHtml).append(pageHtml);
|
||||||
return a;
|
return a;
|
||||||
},
|
},
|
||||||
// 阻止Layui的一些默认事件
|
|
||||||
preventEvent: function() {
|
preventEvent: function() {
|
||||||
var item = '#' + ICON_BODY + ' .layui-anim';
|
var item = '#' + ICON_BODY + ' .layui-anim';
|
||||||
a.event('click', item, function (e) {
|
a.event('click', item, function (e) {
|
||||||
|
|
@ -248,7 +246,6 @@ layui.define(['laypage', 'form'], function (exports) {
|
||||||
});
|
});
|
||||||
return a;
|
return a;
|
||||||
},
|
},
|
||||||
// 分页
|
|
||||||
page: function () {
|
page: function () {
|
||||||
var icon = '#' + PAGE_ID + ' .layui-iconpicker-page-operate .layui-icon';
|
var icon = '#' + PAGE_ID + ' .layui-iconpicker-page-operate .layui-icon';
|
||||||
|
|
||||||
|
|
@ -35,13 +35,10 @@ layui.define(['table', 'jquery', 'element'], function (exports) {
|
||||||
,option.msg);
|
,option.msg);
|
||||||
}
|
}
|
||||||
else if(option.type==5){
|
else if(option.type==5){
|
||||||
|
|
||||||
|
|
||||||
Notiflix.Block.Dots(
|
Notiflix.Block.Dots(
|
||||||
option.elem
|
option.elem
|
||||||
,option.msg);
|
,option.msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(option.type==6){
|
else if(option.type==6){
|
||||||
Notiflix.Block.Pulse(
|
Notiflix.Block.Pulse(
|
||||||
option.elem
|
option.elem
|
||||||
|
|
@ -88,7 +85,6 @@ layui.define(['table', 'jquery', 'element'], function (exports) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.confirm = function(option){
|
this.confirm = function(option){
|
||||||
Notiflix.Confirm.Show(
|
Notiflix.Confirm.Show(
|
||||||
option.title,
|
option.title,
|
||||||
|
|
@ -109,7 +105,6 @@ layui.define(['table', 'jquery', 'element'], function (exports) {
|
||||||
_right.open();
|
_right.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.loadRemove = function(time){
|
this.loadRemove = function(time){
|
||||||
Notiflix.Loading.Remove(time);
|
Notiflix.Loading.Remove(time);
|
||||||
}
|
}
|
||||||
|
|
@ -10,7 +10,7 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
||||||
};
|
};
|
||||||
|
|
||||||
pearMenu.prototype.render = function(opt) {
|
pearMenu.prototype.render = function(opt) {
|
||||||
//默认配置值
|
|
||||||
var option = {
|
var option = {
|
||||||
elem: opt.elem,
|
elem: opt.elem,
|
||||||
async: opt.async,
|
async: opt.async,
|
||||||
|
|
@ -103,7 +103,6 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
||||||
$("#" + this.option.elem + " a[menu-id='" + pearId + "']").parents(".layui-nav-item").addClass("layui-nav-itemed");
|
$("#" + this.option.elem + " a[menu-id='" + pearId + "']").parents(".layui-nav-item").addClass("layui-nav-itemed");
|
||||||
$("#" + this.option.elem + " a[menu-id='" + pearId + "']").parents("dd").addClass("layui-nav-itemed");
|
$("#" + this.option.elem + " a[menu-id='" + pearId + "']").parents("dd").addClass("layui-nav-itemed");
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#" + this.option.elem + " a[menu-id='" + pearId + "']").parent().addClass("layui-this");
|
$("#" + this.option.elem + " a[menu-id='" + pearId + "']").parent().addClass("layui-this");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -128,7 +127,6 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
||||||
width: "60px"
|
width: "60px"
|
||||||
}, 400);
|
}, 400);
|
||||||
isHoverMenu(true, config);
|
isHoverMenu(true, config);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -34,8 +34,6 @@
|
||||||
|
|
||||||
return toastr;
|
return toastr;
|
||||||
|
|
||||||
////////////////
|
|
||||||
|
|
||||||
function error(message, title, optionsOverride) {
|
function error(message, title, optionsOverride) {
|
||||||
return notify({
|
return notify({
|
||||||
type: toastType.error,
|
type: toastType.error,
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue