Skip to content

Commit 936d7f0

Browse files
committed
Make search input take focus on location selection
1 parent 14ef03a commit 936d7f0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/components/SearchLocation.vue

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
<script lang="ts" setup>
22
import { NInput } from 'naive-ui';
3+
import { nextTick, onMounted, ref } from 'vue';
34
import useSocksProxies from '@/composables/useSocksProxies/useSocksProxies';
45
56
const { query } = useSocksProxies();
7+
const inputRef = ref<HTMLInputElement | null>(null);
8+
9+
onMounted(async () => {
10+
await nextTick();
11+
inputRef.value?.focus();
12+
});
613
</script>
714

815
<template>
9-
<NInput v-model:value="query" placeholder="Search" clearable class="mb-3" />
16+
<NInput ref="inputRef" v-model:value="query" placeholder="Search" clearable class="mb-3" />
1017
</template>

0 commit comments

Comments
 (0)