2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-13 08:32:26 +03:00

Add select on tab option and example

This commit is contained in:
Kevin Ball
2018-06-05 15:47:52 -07:00
parent 867a74cddb
commit d2efc965f9
2 changed files with 27 additions and 7 deletions
+25 -6
View File
@@ -329,6 +329,7 @@
v-model="search"
@keydown.delete="maybeDeleteValue"
@keyup.esc="onEscape"
@keydown.tab="onTab"
@keydown.up.prevent="typeAheadUp"
@keydown.down.prevent="typeAheadDown"
@keydown.enter.prevent="typeAheadSelect"
@@ -346,13 +347,13 @@
aria-label="Search for option"
>
<button
v-show="showClearButton"
:disabled="disabled"
<button
v-show="showClearButton"
:disabled="disabled"
@click="clearSelection"
type="button"
class="clear"
title="Clear selection"
type="button"
class="clear"
title="Clear selection"
>
<span aria-hidden="true">&times;</span>
</button>
@@ -680,6 +681,14 @@
type: String,
default: 'auto'
},
/**
* When true, hitting the 'tab' key will select the current select value
* @type {Boolean}
*/
selectOnTab: {
type: Boolean,
default: false
}
},
data() {
@@ -918,6 +927,16 @@
}
},
/**
* Select the current value if selectOnTab is enabled
* @return {void}
*/
onTab() {
if (this.selectOnTab) {
this.typeAheadSelect();
}
},
/**
* Determine if an option exists
* within this.mutableOptions array.