You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and dots ('.'), can be up to 35 characters long. Letters must be lowercase.
26 lines
505 B
26 lines
505 B
<script setup> |
|
import { onMounted, ref } from 'vue'; |
|
|
|
const model = defineModel({ |
|
type: String, |
|
required: true, |
|
}); |
|
|
|
const input = ref(null); |
|
|
|
onMounted(() => { |
|
if (input.value.hasAttribute('autofocus')) { |
|
input.value.focus(); |
|
} |
|
}); |
|
|
|
defineExpose({ focus: () => input.value.focus() }); |
|
</script> |
|
|
|
<template> |
|
<input |
|
class="rounded-md border-gray-600 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" |
|
v-model="model" |
|
ref="input" |
|
/> |
|
</template>
|
|
|