diff --git a/docs/content/3.components/form.md b/docs/content/3.components/form.md index ae19171a..89dd9489 100644 --- a/docs/content/3.components/form.md +++ b/docs/content/3.components/form.md @@ -24,7 +24,7 @@ links: :component-events -### Exposed +### Expose When accessing the component via a template ref, you can use the following: diff --git a/docs/content/3.components/input.md b/docs/content/3.components/input.md index 75afcbcb..fd35626e 100644 --- a/docs/content/3.components/input.md +++ b/docs/content/3.components/input.md @@ -183,6 +183,14 @@ props: :component-events +### Expose + +When accessing the component via a template ref, you can use the following: + +| Name | Type | +| ---- | ---- | +| `inputRef`{lang="ts-type"} | `Ref`{lang="ts-type"} | + ## Theme :component-theme diff --git a/docs/content/3.components/textarea.md b/docs/content/3.components/textarea.md index eb62b94e..16cb8de0 100644 --- a/docs/content/3.components/textarea.md +++ b/docs/content/3.components/textarea.md @@ -144,6 +144,14 @@ props: :component-events +### Expose + +When accessing the component via a template ref, you can use the following: + +| Name | Type | +| ---- | ---- | +| `textareaRef`{lang="ts-type"} | `Ref`{lang="ts-type"} | + ## Theme :component-theme diff --git a/src/runtime/components/Input.vue b/src/runtime/components/Input.vue index 9ca99d51..edbe2996 100644 --- a/src/runtime/components/Input.vue +++ b/src/runtime/components/Input.vue @@ -133,6 +133,10 @@ function onBlur(event: FocusEvent) { emits('blur', event) } +defineExpose({ + inputRef +}) + onMounted(() => { setTimeout(() => { autoFocus() diff --git a/src/runtime/components/InputMenu.vue b/src/runtime/components/InputMenu.vue index a795ca42..193dba99 100644 --- a/src/runtime/components/InputMenu.vue +++ b/src/runtime/components/InputMenu.vue @@ -228,6 +228,10 @@ function onUpdateOpen(value: boolean) { emits('focus', event) } } + +defineExpose({ + inputRef +})