Browse Source

refactor(laydate): 将 mark 和 holidays 选项函数类型的第一个参数由数组改为对象 (#1848)

pull/1855/head
morning-star 7 months ago committed by GitHub
parent
commit
d8d0cbad40
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 12
      docs/laydate/detail/options.md
  2. 4
      src/modules/laydate.js

12
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) {

4
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);
}

Loading…
Cancel
Save