feat(Calendar): add default-date prop and remove v-model

This commit is contained in:
陈嘉涵
2019-12-26 10:10:29 +08:00
committed by neverland
parent 779dcf4e54
commit f49c21a7ca
4 changed files with 42 additions and 51 deletions

View File

@@ -13,7 +13,7 @@ export default createComponent({
showMark: Boolean,
showTitle: Boolean,
rowHeight: Number,
currentValue: [Date, Array]
currentDate: [Date, Array]
},
data() {
@@ -76,18 +76,18 @@ export default createComponent({
methods: {
getDayType(day) {
const { type, minDate, maxDate, currentValue } = this;
const { type, minDate, maxDate, currentDate } = this;
if (compareDay(day, minDate) < 0 || compareDay(day, maxDate) > 0) {
return 'disabled';
}
if (type === 'single') {
return compareDay(day, currentValue) === 0 ? 'selected' : '';
return compareDay(day, currentDate) === 0 ? 'selected' : '';
}
if (type === 'range') {
const [startDay, endDay] = this.currentValue;
const [startDay, endDay] = this.currentDate;
if (!startDay) {
return;