From 1d9056bd0ca59f20a15c6f0792f43fbd32cb62c6 Mon Sep 17 00:00:00 2001 From: sunxb <470459819@qq.com> Date: Wed, 16 Nov 2022 11:04:06 +0800 Subject: [PATCH] =?UTF-8?q?laydate=E4=BF=AE=E5=A4=8D=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=88=87=E6=8D=A2=E7=9A=84=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=9B=E4=BF=AE=E5=A4=8Dgulp=E6=89=93?= =?UTF-8?q?=E5=8C=85=E7=8B=AC=E7=AB=8B=E7=BB=84=E4=BB=B6laydate=E7=9A=84?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E8=AF=AD=E5=8F=A5=E6=B2=A1=E6=9C=89=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E5=88=B0=E6=9C=80=E6=96=B0=E7=9A=84=E6=83=85=E5=86=B5?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E6=89=93=E5=8C=85=E5=87=BA=E6=9D=A5=E7=9A=84?= =?UTF-8?q?laydate=E7=8B=AC=E7=AB=8B=E7=BB=84=E4=BB=B6=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gulpfile.js | 6 ++++-- src/modules/lay.js | 2 +- src/modules/laydate.js | 12 ++++++------ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 77f64418..7e33e880 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -136,9 +136,11 @@ exports.laydate = () => { // gulp laydate // js return gulp.src(['./src/layui.js', './src/modules/{lay,laydate}.js']) .pipe(replace('win.layui =', 'var layui =')) // 将 layui 替换为局部变量 - .pipe(replace('})(window); //gulp build: layui-footer', '')) // 替换 layui.js 的落脚 - .pipe(replace('(function(window){ //gulp build: lay-header', '')) // 替换 lay.js 的头部 + .pipe(replace('}(window); //gulp build: layui-footer', '')) // 替换 layui.js 的落脚 + .pipe(replace(';!function(window){ //gulp build: lay-header', '')) // 替换 lay.js 的头部 + .pipe(replace('}(window, window.document); //gulp build: lay-footer', '')) // 替换 lay.js 的落脚 .pipe(concat('laydate.js', {newLine: ''})) + .pipe(replace(';!function(window, document){ //gulp build: laydate-header', '')) // 替换 laydate.js 的头部 .pipe(header.apply(null, comment)) //追加头部 .pipe(gulp.dest(dest + 'src')); }; diff --git a/src/modules/lay.js b/src/modules/lay.js index 427c9359..fceff512 100644 --- a/src/modules/lay.js +++ b/src/modules/lay.js @@ -428,4 +428,4 @@ }); } -}(window, window.document); \ No newline at end of file +}(window, window.document); //gulp build: lay-footer \ No newline at end of file diff --git a/src/modules/laydate.js b/src/modules/laydate.js index 3393e972..102339a8 100644 --- a/src/modules/laydate.js +++ b/src/modules/laydate.js @@ -1,6 +1,6 @@ /** layDate 日期与时间控件 | MIT Licensed */ -;!function(window, document){ +;!function(window, document){ //gulp build: laydate-header "use strict"; var isLayui = window.layui && layui.define, ready = { @@ -42,7 +42,7 @@ ,ready: function(callback){ var cssname = 'laydate'; var ver = '' - var path = (isLayui ? 'modules/' : 'css/') + 'laydate.css?v='+ laydate.v + ver; + var path = (isLayui ? 'modules/' : '') + 'laydate.css?v='+ laydate.v + ver; isLayui ? ( layui['layui.all'] @@ -1503,7 +1503,7 @@ ,lang = that.lang() ,isOut, elemBtn = lay(that.footer).find(ELEM_CONFIRM); if(options.range && options.type !== 'time'){ - start = start || that.startDate || options.dateTime; + start = start || (that.calendarLinkage ? that.startDate : options.dateTime); end = end || that.endDate; isOut = that.newDate(start).getTime() > that.newDate(end).getTime(); @@ -1699,6 +1699,8 @@ //选择日期 Class.prototype.choose = function(td, index){ + if(td.hasClass(DISABLED)) return; + var that = this ,options = that.config; @@ -1723,9 +1725,7 @@ ,month: (YMD[1] | 0) - 1 ,date: YMD[2] | 0 }; - - if(td.hasClass(DISABLED)) return; - + lay.extend(dateTime, YMD); //同步 dateTime //范围选择