diff --git a/pages/template/calendar/calendar.uts b/pages/template/calendar/calendar.uts index 0950683b88c73d73fa3b19373a39f363cc014b8f..765be1a0f94c2301f4f1d3968362194c8a47364c 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 f786b99b7db0e396f614b5536b5c5dc3732b9078..dd56c76e08ccf42b59bd6ab12d1ec26c15d2c657 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 +