From 6017ed750953bdc0bfdfad4c30ee872c8f8f0690 Mon Sep 17 00:00:00 2001 From: Sergio Crisostomo Date: Mon, 5 Feb 2018 07:50:23 +0100 Subject: [PATCH] update scroll when panel opens --- src/components/date-picker/base/time-spinner.vue | 1 - src/components/date-picker/panel/panel-mixin.js | 5 ++++- src/components/date-picker/picker.vue | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/date-picker/base/time-spinner.vue b/src/components/date-picker/base/time-spinner.vue index 07fdd8f..86d1296 100644 --- a/src/components/date-picker/base/time-spinner.vue +++ b/src/components/date-picker/base/time-spinner.vue @@ -194,7 +194,6 @@ } }, mounted () { - this.updateScroll(); this.$nextTick(() => this.compiled = true); } }; diff --git a/src/components/date-picker/panel/panel-mixin.js b/src/components/date-picker/panel/panel-mixin.js index d227725..4ce733a 100644 --- a/src/components/date-picker/panel/panel-mixin.js +++ b/src/components/date-picker/panel/panel-mixin.js @@ -41,6 +41,9 @@ export default { handleConfirm(visible) { this.$emit('on-pick', this.dates, visible); }, - + onToggleVisibility(open){ + const timeSpinner = this.$refs.timeSpinner; + if (open && timeSpinner) timeSpinner.updateScroll(); + } } }; diff --git a/src/components/date-picker/picker.vue b/src/components/date-picker/picker.vue index ea56414..4c093e8 100644 --- a/src/components/date-picker/picker.vue +++ b/src/components/date-picker/picker.vue @@ -230,12 +230,15 @@ handleFocus () { if (this.readonly) return; this.visible = true; + this.$refs.pickerPanel.onToggleVisibility(true); }, handleBlur () { this.visible = false; this.onSelectionModeChange(this.type); this.internalValue = this.internalValue.slice(); // trigger panel watchers to reset views this.reset(); + this.$refs.pickerPanel.onToggleVisibility(false); + }, reset(){ this.$refs.pickerPanel.reset && this.$refs.pickerPanel.reset(); -- libgit2 0.21.4