NuxtN
Nuxt2y ago
10 replies
cak malik

Can't use ref for focus input (SOLVED)

why doesnt work with nuxt

this is my code
const searchInput = ref<HTMLInputElement | null>(null);
onMounted(() => {
searchInput.value?.focus();
});

and i got error
500

searchInput.value.focus is not a function
Was this page helpful?