提交 f4250d6f 编写于 作者: M mehaotian

fix: 修改日历示例代码类型警告问题

上级 4f77d055
...@@ -125,7 +125,7 @@ export class Lunar { ...@@ -125,7 +125,7 @@ export class Lunar {
* 返回农历y年闰月是哪个月;若y年没有闰月 则返回0 * 返回农历y年闰月是哪个月;若y年没有闰月 则返回0
* @param lunar Year * @param lunar Year
* @return Number (0-12) * @return Number (0-12)
* @eg:let leapMonth = calendar.leapMonth(1987) ;//leapMonth=6 * @eg:let leapMonth = calendar.leapMonth(1987) ;//leapMonth=6
*/ */
leapMonth(year : number) : number { leapMonth(year : number) : number {
return lunarYears[year - 1900] & 0xF; return lunarYears[year - 1900] & 0xF;
...@@ -146,7 +146,7 @@ export class Lunar { ...@@ -146,7 +146,7 @@ export class Lunar {
// 某年份农历各月天数 // 某年份农历各月天数
lunarMonthDays(year : number) : number[] { lunarMonthDays(year : number) : number[] {
let monthDays = this.lunarMonthDaysMap.get(year) let monthDays = this.lunarMonthDaysMap.get(year)
if (monthDays != null) { if (monthDays != null) {
return monthDays return monthDays
...@@ -164,7 +164,7 @@ export class Lunar { ...@@ -164,7 +164,7 @@ export class Lunar {
// 添加闰月 // 添加闰月
let leapM = this.leapMonth(year); 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) this.lunarMonthDaysMap.set(year, monthDays)
return monthDays; return monthDays;
...@@ -265,7 +265,7 @@ export class Lunar { ...@@ -265,7 +265,7 @@ export class Lunar {
} else { } else {
// 补偿公历1901年2月的农历信息 // 补偿公历1901年2月的农历信息
if (offset == -23) { if (offset == -23) {
const info : InfoType = { let info : InfoType = {
lunarY: i, lunarY: i,
lunarM: 12, lunarM: 12,
lunarD: 8, lunarD: 8,
...@@ -294,4 +294,4 @@ export class Lunar { ...@@ -294,4 +294,4 @@ export class Lunar {
return info return info
} }
} }
\ No newline at end of file
...@@ -140,7 +140,8 @@ ...@@ -140,7 +140,8 @@
// 绘制日历顶部信息 // 绘制日历顶部信息
drawHeader() { drawHeader() {
const refs = this.$refs['draw-header'] as INode 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 date_header_map = ['一', '二', '三', '四', '五', '六', '日']
const width = refs.getBoundingClientRect().width const width = refs.getBoundingClientRect().width
...@@ -168,6 +169,7 @@ ...@@ -168,6 +169,7 @@
const start_time = Date.now() const start_time = Date.now()
const refs = this.$refs['draw-weeks'] as INode const refs = this.$refs['draw-weeks'] as INode
let ctx = refs.getDrawableContext() let ctx = refs.getDrawableContext()
if (ctx == null) return
const dom = refs.getBoundingClientRect() const dom = refs.getBoundingClientRect()
const width = dom.width const width = dom.width
const height = dom.height const height = dom.height
...@@ -283,4 +285,4 @@ ...@@ -283,4 +285,4 @@
justify-content: space-between; justify-content: space-between;
margin: 20px 0; margin: 20px 0;
} }
</style> </style>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册