2
0
mirror of https://github.com/tenrok/vue2-datepicker.git synced 2026-06-23 16:30:36 +03:00

fix: calendar-change event frequency

This commit is contained in:
mxie
2018-10-30 12:03:13 +08:00
parent 391cc97f4e
commit b1a5a41cbd
+4 -1
View File
@@ -231,14 +231,17 @@ export default {
} }
} else { } else {
this.showPanelNone() this.showPanelNone()
this.updateNow(this.value)
} }
}, },
// 根据value更新日历 // 根据value更新日历
updateNow (value) { updateNow (value) {
const now = value ? new Date(value) : new Date() const now = value ? new Date(value) : new Date()
const oldNow = new Date(this.now) const oldNow = new Date(this.now)
this.dispatch('DatePicker', 'calendar-change', [now, oldNow])
this.now = now this.now = now
if (this.visible) {
this.dispatch('DatePicker', 'calendar-change', [now, oldNow])
}
}, },
getCriticalTime (value) { getCriticalTime (value) {
if (!value) { if (!value) {