提交 f4250d6f 编写于 作者: M mehaotian

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

上级 4f77d055
......@@ -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
}
......@@ -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;
}
</style>
\ No newline at end of file
</style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册