update DatePicker

update DatePicker
This commit is contained in:
梁灏 2016-12-16 09:18:35 +08:00
parent 344131a7af
commit 13be443453
4 changed files with 14 additions and 6 deletions

View file

@ -11,7 +11,10 @@
props: {
date: {},
year: {},
disabledDate: {}
disabledDate: {},
selectionMode: {
default: 'year'
}
},
computed: {
classes () {
@ -37,7 +40,7 @@
const date = new Date(this.date);
date.setFullYear(cell.text);
cell.disabled = typeof this.disabledDate === 'function' && this.disabledDate(date);
cell.disabled = typeof this.disabledDate === 'function' && this.disabledDate(date) && this.selectionMode === 'year';
cell.selected = Number(this.year) === cell.text;
cells.push(cell);