Skip to content

Commit

Permalink
fix: configs auto complete enter key, close #35
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Apr 9, 2024
1 parent 5051244 commit 328ede6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/pages/configs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ const autoCompleteIndex = ref(0)
const autoCompleteOpen = ref(false)
function autoCompleteConfirm(idx = autoCompleteIndex.value) {
if (!autoCompleteOpen.value)
return
input.value = filters.filepath = autoCompleteFiles.value[idx]?.item || filters.filepath
autoCompleteOpen.value = false
}
Expand All @@ -77,6 +79,8 @@ function autoCompleteBlur() {
}
function autoCompleteMove(delta: number) {
if (!autoCompleteOpen.value)
return
autoCompleteIndex.value += delta
if (autoCompleteIndex.value < 0)
autoCompleteIndex.value += autoCompleteFiles.value.length
Expand Down Expand Up @@ -166,6 +170,7 @@ watch(
if (filters.filepath !== input.value)
input.value = filters.filepath
},
{ flush: 'sync' },
)
const configEls = new Map<number, HTMLElement>()
Expand Down

0 comments on commit 328ede6

Please sign in to comment.