mirror of https://github.com/layui/layui
优化 laydate 代码细节
parent
77bb19352c
commit
239ac1ebc3
|
@ -17,13 +17,13 @@
|
||||||
lay.layui.link(laydate.path + href, fn, cssname);
|
lay.layui.link(laydate.path + href, fn, cssname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
// 识别预先可能定义的指定全局对象
|
// 识别预先可能定义的指定全局对象
|
||||||
,GLOBAL = window.LAYUI_GLOBAL || {}
|
var GLOBAL = window.LAYUI_GLOBAL || {};
|
||||||
|
|
||||||
// 外部调用
|
// 外部调用
|
||||||
,laydate = {
|
var laydate = {
|
||||||
v: '5.4.0' // layDate 版本号
|
v: '5.4.0' // layDate 版本号
|
||||||
,config: {
|
,config: {
|
||||||
weekStart: 0, // 默认周日一周的开始
|
weekStart: 0, // 默认周日一周的开始
|
||||||
|
@ -52,10 +52,10 @@
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
// 操作当前实例
|
// 操作当前实例
|
||||||
,thisModule = function(){
|
var thisModule = function(){
|
||||||
var that = this
|
var that = this
|
||||||
,options = that.config
|
,options = that.config
|
||||||
,id = options.id;
|
,id = options.id;
|
||||||
|
@ -69,15 +69,31 @@
|
||||||
}
|
}
|
||||||
,config: that.config
|
,config: that.config
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
// 字符常量
|
// 字符常量
|
||||||
,MOD_NAME = 'laydate', ELEM = '.layui-laydate', THIS = 'layui-this', SHOW = 'layui-show', HIDE = 'layui-hide', DISABLED = 'laydate-disabled', LIMIT_YEAR = [100, 200000]
|
var MOD_NAME = 'laydate';
|
||||||
|
var ELEM = '.layui-laydate';
|
||||||
|
var THIS = 'layui-this';
|
||||||
|
var SHOW = 'layui-show';
|
||||||
|
var HIDE = 'layui-hide';
|
||||||
|
var DISABLED = 'laydate-disabled';
|
||||||
|
var LIMIT_YEAR = [100, 200000];
|
||||||
|
|
||||||
,ELEM_STATIC = 'layui-laydate-static', ELEM_LIST = 'layui-laydate-list', ELEM_SELECTED = 'laydate-selected', ELEM_HINT = 'layui-laydate-hint', ELEM_PREV = 'laydate-day-prev', ELEM_NEXT = 'laydate-day-next', ELEM_FOOTER = 'layui-laydate-footer', ELEM_CONFIRM = '.laydate-btns-confirm', ELEM_TIME_TEXT = 'laydate-time-text', ELEM_TIME_BTN = 'laydate-btns-time', ELEM_PREVIEW = 'layui-laydate-preview'
|
var ELEM_STATIC = 'layui-laydate-static';
|
||||||
|
var ELEM_LIST = 'layui-laydate-list';
|
||||||
|
var ELEM_SELECTED = 'laydate-selected';
|
||||||
|
var ELEM_HINT = 'layui-laydate-hint';
|
||||||
|
var ELEM_PREV = 'laydate-day-prev';
|
||||||
|
var ELEM_NEXT = 'laydate-day-next';
|
||||||
|
var ELEM_FOOTER = 'layui-laydate-footer';
|
||||||
|
var ELEM_CONFIRM = '.laydate-btns-confirm';
|
||||||
|
var ELEM_TIME_TEXT = 'laydate-time-text';
|
||||||
|
var ELEM_TIME_BTN = 'laydate-btns-time';
|
||||||
|
var ELEM_PREVIEW = 'layui-laydate-preview';
|
||||||
|
|
||||||
// 组件构造器
|
// 组件构造器
|
||||||
,Class = function(options){
|
var Class = function(options){
|
||||||
var that = this;
|
var that = this;
|
||||||
that.index = ++laydate.index;
|
that.index = ++laydate.index;
|
||||||
that.config = lay.extend({}, that.config, laydate.config, options);
|
that.config = lay.extend({}, that.config, laydate.config, options);
|
||||||
|
@ -101,10 +117,10 @@
|
||||||
laydate.ready(function(){
|
laydate.ready(function(){
|
||||||
that.init();
|
that.init();
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
// 日期格式字符
|
// 日期格式字符
|
||||||
,dateType = 'yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s';
|
var dateType = 'yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s';
|
||||||
|
|
||||||
// 将日期格式字符转换为数组
|
// 将日期格式字符转换为数组
|
||||||
thisModule.formatArr = function(format){
|
thisModule.formatArr = function(format){
|
||||||
|
|
Loading…
Reference in New Issue