From f4250d6f7c500a5ea5ef2bb48ac7a383f4eb5387 Mon Sep 17 00:00:00 2001 From: mehaotian <490272692@qq.com> Date: Tue, 12 Sep 2023 15:38:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=97=A5=E5=8E=86?= =?UTF-8?q?=E7=A4=BA=E4=BE=8B=E4=BB=A3=E7=A0=81=E7=B1=BB=E5=9E=8B=E8=AD=A6?= =?UTF-8?q?=E5=91=8A=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/template/calendar/calendar.uts | 10 +++++----- pages/template/calendar/calendar.uvue | 6 ++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/pages/template/calendar/calendar.uts b/pages/template/calendar/calendar.uts index 0950683b..765be1a0 100644 --- a/pages/template/calendar/calendar.uts +++ b/pages/template/calendar/calendar.uts @@ -125,7 +125,7 @@ export class Lunar { * 返回农历y年闰月是哪个月;若y年没有闰月 则返回0 * @param lunar Year * @return Number (0-12) - * @eg:let leapMonth = calendar.leapMonth(1987) ;//leapMonth=6 + * @eg:let leapMonth = calendar.leapMonth(1987) ;//leapMonth=6 */ leapMonth(year : number) : number { return lunarYears[year - 1900] & 0xF; @@ -146,7 +146,7 @@ export class Lunar { // 某年份农历各月天数 lunarMonthDays(year : number) : number[] { - + let monthDays = this.lunarMonthDaysMap.get(year) if (monthDays != null) { return monthDays @@ -164,7 +164,7 @@ export class Lunar { // 添加闰月 let leapM = this.leapMonth(year); - if (leapM > 0) monthDays.splice(leapM, 0, leapDays(year)); + if (leapM > 0) monthDays.splice(leapM, 0, this.leapDays(year)); this.lunarMonthDaysMap.set(year, monthDays) return monthDays; @@ -265,7 +265,7 @@ export class Lunar { } else { // 补偿公历1901年2月的农历信息 if (offset == -23) { - const info : InfoType = { + let info : InfoType = { lunarY: i, lunarM: 12, lunarD: 8, @@ -294,4 +294,4 @@ export class Lunar { return info } -} \ No newline at end of file +} diff --git a/pages/template/calendar/calendar.uvue b/pages/template/calendar/calendar.uvue index f786b99b..dd56c76e 100644 --- a/pages/template/calendar/calendar.uvue +++ b/pages/template/calendar/calendar.uvue @@ -140,7 +140,8 @@ // 绘制日历顶部信息 drawHeader() { const refs = this.$refs['draw-header'] as INode - let ctx = refs.getDrawableContext() + let ctx = refs.getDrawableContext() + if (ctx == null) return const date_header_map = ['一', '二', '三', '四', '五', '六', '日'] const width = refs.getBoundingClientRect().width @@ -168,6 +169,7 @@ const start_time = Date.now() const refs = this.$refs['draw-weeks'] as INode let ctx = refs.getDrawableContext() + if (ctx == null) return const dom = refs.getBoundingClientRect() const width = dom.width const height = dom.height @@ -283,4 +285,4 @@ justify-content: space-between; margin: 20px 0; } - \ No newline at end of file + -- GitLab