Skip to content

Commit 42e61d3

Browse files
committed
fix(afcl): support input.focus() for AFCL <Input ref="input"
1 parent e4870ab commit 42e61d3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

adminforth/spa/src/afcl/Input.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
<!-- translate needed for bumping ring above prefix without z-index -->
1111
<input
12+
ref="input"
1213
v-bind="$attrs"
1314
:type="type"
1415
@input="$emit('update:modelValue', $event.target?.value)"
@@ -31,6 +32,8 @@
3132

3233
<script setup lang="ts">
3334
35+
import { ref } from 'vue';
36+
3437
const props = defineProps({
3538
type: String,
3639
fullWidth: Boolean,
@@ -39,6 +42,11 @@ const props = defineProps({
3942
prefix: String,
4043
})
4144
45+
const input = ref<HTMLInputElement | null>(null)
46+
47+
defineExpose({
48+
focus: () => input.value?.focus(),
49+
});
4250
4351
</script>
4452

0 commit comments

Comments
 (0)