2
0
mirror of https://github.com/tenrok/vue2-datepicker.git synced 2026-06-09 01:42:27 +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 {
this.showPanelNone()
this.updateNow(this.value)
}
},
// 根据value更新日历
updateNow (value) {
const now = value ? new Date(value) : new Date()
const oldNow = new Date(this.now)
this.dispatch('DatePicker', 'calendar-change', [now, oldNow])
this.now = now
if (this.visible) {
this.dispatch('DatePicker', 'calendar-change', [now, oldNow])
}
},
getCriticalTime (value) {
if (!value) {