fix(#24): Fix item select
This commit is contained in:
1 parent
bbaeacb1cb
commit
999abd1d1e
2 files changed
+3
-3
No files matched your search
@@ -43,7 +43,7 @@ const select = (item?: T) => {
|
||||
const submit = () => {
|
||||
if (currentIndex.value >= 0 && currentIndex.value < props.items.length) {
|
||||
select(props.items[currentIndex.value]);
|
||||
} else if (modelValue.value === undefined && props.items.length > 0) {
|
||||
} else if (props.items.length > 0) {
|
||||
select(props.items[0]);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -55,7 +55,7 @@ const submit = async () => {
|
||||
|
||||
select(v);
|
||||
await nextTick();
|
||||
} else if (modelValue.value === undefined && suggestions.value.length > 0) {
|
||||
} else if (suggestions.value.length > 0) {
|
||||
select(suggestions.value[0]);
|
||||
await nextTick();
|
||||
}
|
||||
@@ -92,7 +92,7 @@ watchEffect(async () => {
|
||||
<img v-if="modelValue?.id" :src="`https://images.evetech.net/types/${modelValue.id}/icon?size=32`" alt="" />
|
||||
<input type="text" v-model="name" @keyup.enter="submit" @keyup.down="moveDown" @keyup.up="moveUp" />
|
||||
</div>
|
||||
<div v-if="suggestions.length > 1" class="z-20 absolute w-96">
|
||||
<div v-if="suggestions.length > 0" class="z-20 absolute w-96">
|
||||
<div v-bind="containerProps" class="rounded-b" style="height: 300px">
|
||||
<div v-bind="wrapperProps">
|
||||
<div v-for="s in list" :key="s.index" class="hover:bg-slate-700" :class="{'bg-slate-500': s.index !== currentIndex, 'bg-emerald-500': s.index === currentIndex}" @click="select(s.data)">
|
||||
|
||||
Reference in new issue
Block a user