2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-10 07:52:23 +03:00

set typeAheadPointer on hover, reset value when options or multiple change

This commit is contained in:
Jeff Sagal
2016-03-08 18:42:30 -08:00
parent d937e86e75
commit f3afb01e98
6 changed files with 22156 additions and 68 deletions
+11 -6
View File
@@ -142,7 +142,7 @@
</div>
<ul v-show="open" :transition="transition" :style="{ 'max-height': maxHeight }" class="dropdown-menu animated">
<li v-for="option in filteredOptions" :class="{ active: isOptionSelected(option), highlight: $index === typeAheadPointer }">
<li v-for="option in filteredOptions" :class="{ active: isOptionSelected(option), highlight: $index === typeAheadPointer }" @mouseover="typeAheadPointer = $index">
<a @mousedown.prevent="select(option)">
{{ getOptionLabel(option) }}
</a>
@@ -159,7 +159,6 @@
props: {
value: {
// type: Array,
twoway: true,
required: true
},
@@ -201,17 +200,23 @@
}
},
ready() {
this.$watch('open', function(open) {
watch: {
open( open ) {
if( open ) {
this.$els.search.focus();
} else {
this.$els.search.blur();
this.typeAheadPointer = 0;
}
});
},
options() {
this.$set('value', this.multiple ? [] : null)
},
multiple( val ) {
this.$set('value', val ? [] : null)
}
},
methods: {
select(option) {
if (! this.isOptionSelected(option) ) {