Skip to content

Commit

Permalink
expose focus on AFormTextarea and AFormTextField
Browse files Browse the repository at this point in the history
  • Loading branch information
volar committed Dec 19, 2024
1 parent 8bf15eb commit ebe4136
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/components/form/AFormTextField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ const disabledComputed = computed(() => {
if (isDefined(props.disabled)) return props.disabled
return !!lockedByUserLocal.value
})
const focus = () => {
textFieldRef.value?.focus()
}
defineExpose({
focus,
})
</script>

<template>
Expand Down
8 changes: 8 additions & 0 deletions src/components/form/AFormTextarea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ const showCounterWarning = (counterValue: string | number | undefined) => {
}
return false
}
const focus = () => {
textareaRef.value?.focus()
}
defineExpose({
focus,
})
</script>

<template>
Expand Down

0 comments on commit ebe4136

Please sign in to comment.