update DatePicker
update DatePicker
This commit is contained in:
parent
e1874103ad
commit
344131a7af
4 changed files with 10 additions and 4 deletions
|
@ -67,6 +67,7 @@
|
|||
if (target.tagName === 'EM') {
|
||||
const cell = this.cells[parseInt(event.target.getAttribute('index'))];
|
||||
if (cell.disabled) return;
|
||||
|
||||
this.$emit('on-pick', cell.text);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@
|
|||
|
||||
this.date.setFullYear(year);
|
||||
if (this.selectionMode === 'year') {
|
||||
this.$emit('on-pick', new Date(year));
|
||||
this.$emit('on-pick', new Date(year, 0, 1));
|
||||
} else {
|
||||
this.currentView = 'month';
|
||||
}
|
||||
|
|
|
@ -269,6 +269,8 @@
|
|||
this.visualValue = correctValue;
|
||||
event.target.value = correctValue;
|
||||
this.internalValue = correctDate;
|
||||
|
||||
if (correctValue !== oldValue) this.emitChange(correctDate);
|
||||
},
|
||||
handleInputMouseenter () {
|
||||
if (this.readonly || this.disabled) return;
|
||||
|
@ -298,7 +300,7 @@
|
|||
}
|
||||
|
||||
this.picker.$on('on-pick', (date, visible = false) => {
|
||||
this.$emit('on-change', formatDate(date, this.format || DEFAULT_FORMATS[this.type]));
|
||||
this.emitChange(date);
|
||||
this.value = date;
|
||||
this.visible = visible;
|
||||
this.picker.value = date;
|
||||
|
@ -313,6 +315,9 @@
|
|||
this.picker.value = this.internalValue;
|
||||
}
|
||||
this.picker.resetView && this.picker.resetView();
|
||||
},
|
||||
emitChange (date) {
|
||||
this.$emit('on-change', formatDate(date, this.format || DEFAULT_FORMATS[this.type]));
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
|
|
@ -33,13 +33,13 @@
|
|||
// return time && time.valueOf() < Date.now();
|
||||
}
|
||||
},
|
||||
format: 'yyyy/MM/dd'
|
||||
format: 'yyyy年MM月dd日'
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
methods: {
|
||||
change (date) {
|
||||
// console.log(date)
|
||||
console.log(date)
|
||||
},
|
||||
change2 (s) {
|
||||
// console.log(s)
|
||||
|
|
Loading…
Add table
Reference in a new issue