From 66d2c8d8c97e19fdbd969f97dd3d6a28f27c415f Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Wed, 01 Nov 2023 16:07:03 +0800
Subject: [PATCH] fix:小程序分享功能和秒级数据
---
uni_modules/uview-ui/components/u-calendar/util.js | 85 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 85 insertions(+), 0 deletions(-)
diff --git a/uni_modules/uview-ui/components/u-calendar/util.js b/uni_modules/uview-ui/components/u-calendar/util.js
new file mode 100644
index 0000000..ca4736b
--- /dev/null
+++ b/uni_modules/uview-ui/components/u-calendar/util.js
@@ -0,0 +1,85 @@
+export default {
+ methods: {
+ // ������������������
+ setMonth() {
+ // ���������������
+ const day = dayjs(this.date).date(1).day()
+ const start = day == 0 ? 6 : day - 1
+
+ // ������������
+ const days = dayjs(this.date).endOf('month').format('D')
+
+ // ���������������
+ const prevDays = dayjs(this.date).endOf('month').subtract(1, 'month').format('D')
+
+ // ������������
+ const arr = []
+ // ������������
+ this.month = []
+
+ // ������������������
+ arr.push(
+ ...new Array(start).fill(1).map((e, i) => {
+ const day = prevDays - start + i + 1
+
+ return {
+ value: day,
+ disabled: true,
+ date: dayjs(this.date).subtract(1, 'month').date(day).format('YYYY-MM-DD')
+ }
+ })
+ )
+
+ // ������������������
+ arr.push(
+ ...new Array(days - 0).fill(1).map((e, i) => {
+ const day = i + 1
+
+ return {
+ value: day,
+ date: dayjs(this.date).date(day).format('YYYY-MM-DD')
+ }
+ })
+ )
+
+ // ���������������
+ arr.push(
+ ...new Array(42 - days - start).fill(1).map((e, i) => {
+ const day = i + 1
+
+ return {
+ value: day,
+ disabled: true,
+ date: dayjs(this.date).add(1, 'month').date(day).format('YYYY-MM-DD')
+ }
+ })
+ )
+
+ // ������������
+ for (let n = 0; n < arr.length; n += 7) {
+ this.month.push(
+ arr.slice(n, n + 7).map((e, i) => {
+ e.index = i + n
+
+ // ���������������
+ const custom = this.customList.find((c) => c.date == e.date)
+
+ // ������
+ if (this.lunar) {
+ const {
+ IDayCn,
+ IMonthCn
+ } = this.getLunar(e.date)
+ e.lunar = IDayCn == '������' ? IMonthCn : IDayCn
+ }
+
+ return {
+ ...e,
+ ...custom
+ }
+ })
+ )
+ }
+ }
+ }
+}
--
Gitblit v1.8.0