feat(Calendar): add show-mark prop

This commit is contained in:
陈嘉涵
2019-12-25 11:17:52 +08:00
committed by neverland
parent c9964d5759
commit f65f2cc6cf
3 changed files with 15 additions and 2 deletions

View File

@@ -7,7 +7,8 @@ export default createComponent({
props: {
date: Date,
days: Array,
title: String
title: String,
showMark: Boolean
},
mounted() {
@@ -31,6 +32,12 @@ export default createComponent({
}
},
genMark() {
if (this.showMark) {
return <div class={bem('month-mark')}>{this.date.getMonth() + 1}</div>;
}
},
genDay(item) {
const { type } = item;
@@ -65,7 +72,7 @@ export default createComponent({
<div class={bem('month')}>
{this.genTitle()}
<div class={bem('days')}>
<div class={bem('month-mark')}>{this.date.getMonth() + 1}</div>
{this.genMark()}
{this.days.map(this.genDay)}
</div>
</div>