mirror of
https://github.com/tenrok/vue-select.git
synced 2026-06-22 10:30:34 +03:00
Add select on tab option and example
This commit is contained in:
@@ -68,6 +68,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</v-select>
|
</v-select>
|
||||||
|
|
||||||
|
<v-select placeholder="select on tab" :select-on-tab="true" :options="options"></v-select>
|
||||||
<v-select placeholder="disabled" disabled value="disabled"></v-select>
|
<v-select placeholder="disabled" disabled value="disabled"></v-select>
|
||||||
<v-select placeholder="disabled multiple" disabled multiple :value="['disabled', 'multiple']"></v-select>
|
<v-select placeholder="disabled multiple" disabled multiple :value="['disabled', 'multiple']"></v-select>
|
||||||
<v-select placeholder="filterable=false, @search=searchPeople" label="first_name" :filterable="false" @search="searchPeople" :options="people"></v-select>
|
<v-select placeholder="filterable=false, @search=searchPeople" label="first_name" :filterable="false" @search="searchPeople" :options="people"></v-select>
|
||||||
|
|||||||
@@ -329,6 +329,7 @@
|
|||||||
v-model="search"
|
v-model="search"
|
||||||
@keydown.delete="maybeDeleteValue"
|
@keydown.delete="maybeDeleteValue"
|
||||||
@keyup.esc="onEscape"
|
@keyup.esc="onEscape"
|
||||||
|
@keydown.tab="onTab"
|
||||||
@keydown.up.prevent="typeAheadUp"
|
@keydown.up.prevent="typeAheadUp"
|
||||||
@keydown.down.prevent="typeAheadDown"
|
@keydown.down.prevent="typeAheadDown"
|
||||||
@keydown.enter.prevent="typeAheadSelect"
|
@keydown.enter.prevent="typeAheadSelect"
|
||||||
@@ -680,6 +681,14 @@
|
|||||||
type: String,
|
type: String,
|
||||||
default: 'auto'
|
default: 'auto'
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* When true, hitting the 'tab' key will select the current select value
|
||||||
|
* @type {Boolean}
|
||||||
|
*/
|
||||||
|
selectOnTab: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
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
|
* Determine if an option exists
|
||||||
* within this.mutableOptions array.
|
* within this.mutableOptions array.
|
||||||
|
|||||||
Reference in New Issue
Block a user