diff --git a/package/component/src/component/datePicker/components/DatePanel.vue b/package/component/src/component/datePicker/components/DatePanel.vue new file mode 100644 index 00000000..9a08e15f --- /dev/null +++ b/package/component/src/component/datePicker/components/DatePanel.vue @@ -0,0 +1,160 @@ + + + \ No newline at end of file diff --git a/package/component/src/component/datePicker/components/MonthPanel.vue b/package/component/src/component/datePicker/components/MonthPanel.vue new file mode 100644 index 00000000..68f3a357 --- /dev/null +++ b/package/component/src/component/datePicker/components/MonthPanel.vue @@ -0,0 +1,85 @@ + + + \ No newline at end of file diff --git a/package/component/src/component/datePicker/components/PanelFoot.vue b/package/component/src/component/datePicker/components/PanelFoot.vue new file mode 100644 index 00000000..05c2ae8e --- /dev/null +++ b/package/component/src/component/datePicker/components/PanelFoot.vue @@ -0,0 +1,47 @@ + + + \ No newline at end of file diff --git a/package/component/src/component/datePicker/components/TimePanel.vue b/package/component/src/component/datePicker/components/TimePanel.vue new file mode 100644 index 00000000..867d794f --- /dev/null +++ b/package/component/src/component/datePicker/components/TimePanel.vue @@ -0,0 +1,53 @@ + + + \ No newline at end of file diff --git a/package/component/src/component/datePicker/components/YearPanel.vue b/package/component/src/component/datePicker/components/YearPanel.vue new file mode 100644 index 00000000..cdce3c82 --- /dev/null +++ b/package/component/src/component/datePicker/components/YearPanel.vue @@ -0,0 +1,43 @@ + + + \ No newline at end of file diff --git a/package/component/src/component/datePicker/day.ts b/package/component/src/component/datePicker/day.ts index 9e46ecc4..3c66e814 100644 --- a/package/component/src/component/datePicker/day.ts +++ b/package/component/src/component/datePicker/day.ts @@ -52,4 +52,47 @@ const getDayLength = (year: number, month: number): number => { return new Date(year, month + 1, 0).getDate(); }; -export { getDayLength, getYears, getDate, getMonth, getYear, getDay }; + +// 设置日期列表 +const setDateList = (year: number, month: number) => { + const curDays = getDayLength(year, month); // 当月天数 + const prevDays = getDayLength(year, month - 1); // 上月天数 + const curFirstDayWeek = new Date(year, month, 1).getDay(); // 当月第一天星期几 + const list: any[] = []; + // 填充上月天数 + for (let i = prevDays - curFirstDayWeek + 1; i <= prevDays; i++) { + list.push({ + day: i, + value: +new Date(year, month - 1, i), + isRange: false, + isSelected: false, + type: "prev", + }); + } + // 填充当月天数 + for (let i = 1; i <= curDays; i++) { + list.push({ + day: i, + value: +new Date(year, month, i), + isRange: false, + isSelected: false, + type: "current", + }); + } + // 填充下月天数 + const nextDays = 7 - (list.length % 7); + if (nextDays !== 7) { + for (let i = 1; i <= nextDays; i++) { + list.push({ + day: i, + value: +new Date(year, month + 1, i), + isRange: false, + isSelected: false, + type: "next", + }); + } + } + return list; +}; + +export { getDayLength, getYears, getDate, getMonth, getYear,getDay,setDateList }; diff --git a/package/component/src/component/datePicker/index.less b/package/component/src/component/datePicker/index.less index cc81a475..06d3546a 100644 --- a/package/component/src/component/datePicker/index.less +++ b/package/component/src/component/datePicker/index.less @@ -459,3 +459,10 @@ html #layuicss-laydate { height: 71px; line-height: 71px; } +.laydate-range-hover{ + background-color: var(--global-checked-color) !important; + color: white !important; +} +.layui-laydate-content .layui-disabled:hover{ + background-color: transparent !important; +} \ No newline at end of file diff --git a/package/component/src/component/datePicker/index.vue b/package/component/src/component/datePicker/index.vue index ae7a5ca4..6c31ef58 100644 --- a/package/component/src/component/datePicker/index.vue +++ b/package/component/src/component/datePicker/index.vue @@ -1,277 +1,19 @@