From d8d0cbad40a6b67cb1c28e9d3d0e5a7d0a710784 Mon Sep 17 00:00:00 2001 From: morning-star <26325820+Sight-wcg@users.noreply.github.com> Date: Sat, 4 May 2024 17:01:57 +0800 Subject: [PATCH] =?UTF-8?q?refactor(laydate):=20=E5=B0=86=20mark=20?= =?UTF-8?q?=E5=92=8C=20holidays=20=E9=80=89=E9=A1=B9=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E7=9A=84=E7=AC=AC=E4=B8=80=E4=B8=AA=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E7=94=B1=E6=95=B0=E7=BB=84=E6=94=B9=E4=B8=BA=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1=20(#1848)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/laydate/detail/options.md | 12 ++++++------ src/modules/laydate.js | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/laydate/detail/options.md b/docs/laydate/detail/options.md index 612f44d3..b11fed89 100644 --- a/docs/laydate/detail/options.md +++ b/docs/laydate/detail/options.md @@ -638,9 +638,9 @@ mark: { ``` mark: function (ymd, render) { - var y = ymd[0]; - var m = ymd[1]; - var d = ymd[2]; + var y = ymd.year; + var m = ymd.month; + var d = ymd.date; // 字符串 if (m === 6 && d === 1) return render('儿童节'); @@ -689,9 +689,9 @@ holidays: [ ``` holidays: function (ymd, render) { - var y = ymd[0]; - var m = ymd[1]; - var d = ymd[2]; + var y = ymd.year; + var m = ymd.month; + var d = ymd.date; // 字符串 if (y === 2023 && m === 6) { diff --git a/src/modules/laydate.js b/src/modules/laydate.js index fe0d3c26..702863b1 100644 --- a/src/modules/laydate.js +++ b/src/modules/laydate.js @@ -1106,7 +1106,7 @@ } if(typeof options.mark === 'function'){ - options.mark(YMD, render); + options.mark({year: YMD[0], month: YMD[1], date: YMD[2]}, render); }else if(typeof options.mark === 'object'){ render(options.mark); } @@ -1178,7 +1178,7 @@ } if(typeof options.holidays === 'function'){ - options.holidays(YMD, render); + options.holidays({year: YMD[0], month: YMD[1], date: YMD[2]}, render); }else if(layui.type(options.holidays) === 'array'){ render(options.holidays); }