update DatePicker

update DatePicker
This commit is contained in:
梁灏 2016-12-19 21:09:57 +08:00
parent fa3a666da1
commit 0a5c5f4132
5 changed files with 138 additions and 43 deletions

View file

@ -109,7 +109,7 @@
const startYear = Math.floor(year / 10) * 10;
return `${startYear}年 - ${startYear + 9}`;
}
return `${year}`
return `${year}`;
}
},
watch: {
@ -128,8 +128,17 @@
this.date = new Date();
this.$emit('on-pick', '');
},
resetDate () {
this.date = new Date(this.date);
resetView() {
if (this.selectionMode === 'month') {
this.currentView = 'month';
} else if (this.selectionMode === 'year') {
this.currentView = 'year';
} else {
this.currentView = 'date';
}
this.year = this.date.getFullYear();
this.month = this.date.getMonth();
},
prevYear () {
if (this.currentView === 'year') {