From 627c3e0a6920131d75eafa4646db373ccc936546 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期四, 26 十月 2023 13:52:07 +0800
Subject: [PATCH] 小程序diamante
---
minipro_standard/uni_modules/uview-ui/components/u-calendar/util.js | 170 ++++++++++++++++++++++++++++----------------------------
1 files changed, 85 insertions(+), 85 deletions(-)
diff --git a/minipro_standard/uni_modules/uview-ui/components/u-calendar/util.js b/minipro_standard/uni_modules/uview-ui/components/u-calendar/util.js
index f71ad62..ca4736b 100644
--- a/minipro_standard/uni_modules/uview-ui/components/u-calendar/util.js
+++ b/minipro_standard/uni_modules/uview-ui/components/u-calendar/util.js
@@ -1,85 +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
- }
- })
- )
- }
- }
- }
-}
+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.9.3