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