feat: migrate Calendar component

This commit is contained in:
chenjiahan
2020-08-09 21:31:44 +08:00
parent a6888944ea
commit 0dd713f361
9 changed files with 93 additions and 76 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ export default createComponent({
methods: {
genTitle() {
if (this.showTitle) {
const title = this.slots('title') || this.title || t('title');
const title = this.$slots.title?.() || this.title || t('title');
return <div class={bem('header-title')}>{title}</div>;
}
},
+10 -10
View File
@@ -31,6 +31,8 @@ export default createComponent({
firstDayOfWeek: Number,
},
emits: ['click'],
data() {
return {
visible: false,
@@ -183,18 +185,16 @@ export default createComponent({
return 'disabled';
}
if (type === 'single') {
if (Array.isArray(currentDate)) {
if (type === 'multiple') {
return this.getMultipleDayType(day);
}
if (type === 'range') {
return this.getRangeDayType(day);
}
} else if (type === 'single') {
return compareDay(day, currentDate) === 0 ? 'selected' : '';
}
if (type === 'multiple') {
return this.getMultipleDayType(day);
}
/* istanbul ignore else */
if (type === 'range') {
return this.getRangeDayType(day);
}
},
getBottomInfo(type) {