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
+7 -6
View File
@@ -15,10 +15,7 @@
position="bottom"
style="height: 80vh;"
>
<van-calendar
v-model="date.selectSingleDate"
@select="show.selectSingleDate = false"
/>
<van-calendar @select="onSelect($event, 'selectSingleDate')" />
</van-popup>
<van-cell
@@ -36,9 +33,8 @@
style="height: 80vh;"
>
<van-calendar
v-model="date.selectDateRange"
type="range"
@select="show.selectDateRange = false"
@select="onSelect($event, 'selectDateRange')"
/>
</van-popup>
</demo-block>
@@ -93,6 +89,11 @@ export default {
const [start, end] = dateRange;
return `${this.formatDate(start)} - ${this.formatDate(end)}`;
}
},
onSelect(date, type) {
this.date[type] = date;
this.show[type] = false;
}
}
};