diff --git a/src/runtime/components/Input.vue b/src/runtime/components/Input.vue index 20d3db13..8ca5ff98 100644 --- a/src/runtime/components/Input.vue +++ b/src/runtime/components/Input.vue @@ -104,12 +104,6 @@ const ui = computed(() => input({ const inputRef = ref(null) -function autoFocus() { - if (props.autofocus) { - inputRef.value?.focus() - } -} - // Custom function to handle the v-model properties function updateInput(value: string | null) { if (modelModifiers.trim) { @@ -155,15 +149,21 @@ function onBlur(event: FocusEvent) { emits('blur', event) } -defineExpose({ - inputRef -}) +function autoFocus() { + if (props.autofocus) { + inputRef.value?.focus() + } +} onMounted(() => { setTimeout(() => { autoFocus() }, props.autofocusDelay) }) + +defineExpose({ + inputRef +})