mirror of
https://github.com/tenrok/vue-select.git
synced 2026-06-22 10:30:34 +03:00
- closes #95
- $emit focus and blur when opening and closing the dropdown - make createOption default syntax consistent
This commit is contained in:
@@ -191,8 +191,8 @@
|
|||||||
@keydown.up.prevent="typeAheadUp"
|
@keydown.up.prevent="typeAheadUp"
|
||||||
@keydown.down.prevent="typeAheadDown"
|
@keydown.down.prevent="typeAheadDown"
|
||||||
@keyup.enter.prevent="typeAheadSelect"
|
@keyup.enter.prevent="typeAheadSelect"
|
||||||
@blur="open = false"
|
@blur="onSearchBlur"
|
||||||
@focus="open = true"
|
@focus="onSearchFocus"
|
||||||
type="search"
|
type="search"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
:placeholder="searchPlaceholder"
|
:placeholder="searchPlaceholder"
|
||||||
@@ -382,7 +382,7 @@
|
|||||||
*/
|
*/
|
||||||
createOption: {
|
createOption: {
|
||||||
type: Function,
|
type: Function,
|
||||||
default: function (newOption) {
|
default(newOption) {
|
||||||
if (typeof this.mutableOptions[0] === 'object') {
|
if (typeof this.mutableOptions[0] === 'object') {
|
||||||
newOption = {[this.label]: newOption}
|
newOption = {[this.label]: newOption}
|
||||||
}
|
}
|
||||||
@@ -400,6 +400,10 @@
|
|||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable the dropdown entirely.
|
||||||
|
* @type {Boolean}
|
||||||
|
*/
|
||||||
noDrop: {
|
noDrop: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
@@ -591,7 +595,7 @@
|
|||||||
/**
|
/**
|
||||||
* If there is any text in the search input, remove it.
|
* If there is any text in the search input, remove it.
|
||||||
* Otherwise, blur the search input to close the dropdown.
|
* Otherwise, blur the search input to close the dropdown.
|
||||||
* @return {[type]} [description]
|
* @return {void}
|
||||||
*/
|
*/
|
||||||
onEscape() {
|
onEscape() {
|
||||||
if (!this.search.length) {
|
if (!this.search.length) {
|
||||||
@@ -601,6 +605,26 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close the dropdown on blur.
|
||||||
|
* @emits {search:blur}
|
||||||
|
* @return {void}
|
||||||
|
*/
|
||||||
|
onSearchBlur() {
|
||||||
|
this.open = false
|
||||||
|
this.$emit('search:blur')
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open the dropdown on focus.
|
||||||
|
* @emits {search:focus}
|
||||||
|
* @return {void}
|
||||||
|
*/
|
||||||
|
onSearchFocus() {
|
||||||
|
this.open = true
|
||||||
|
this.$emit('search:focus')
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the value on Delete keypress when there is no
|
* Delete the value on Delete keypress when there is no
|
||||||
* text in the search input, & there's tags to delete
|
* text in the search input, & there's tags to delete
|
||||||
|
|||||||
Reference in New Issue
Block a user