make picker close on blur

This commit is contained in:
Sergio Crisostomo 2017-09-21 08:22:05 +02:00
parent 58cd467591
commit 030a522daa
5 changed files with 12 additions and 5 deletions

View file

@ -12,6 +12,7 @@
:name="name"
@on-input-change="handleInputChange"
@on-focus="handleFocus"
@on-blur="handleBlur"
@on-click="handleIconClick"
@mouseenter.native="handleInputMouseenter"
@mouseleave.native="handleInputMouseleave"
@ -290,6 +291,9 @@
if (this.readonly) return;
this.visible = true;
},
handleBlur () {
this.visible = false;
},
handleInputChange (event) {
const oldValue = this.visualValue;
const value = event.target.value;
@ -478,6 +482,9 @@
if (this.picker) this.picker.resetView && this.picker.resetView(true);
this.$refs.drop.destroy();
if (this.open === null) this.$emit('on-open-change', false);
// blur the input
const input = this.$el.querySelector('input');
if (input) input.blur();
}
},
internalValue(val) {