|
|
@ -15,20 +15,13 @@ const root = ref<HTMLInputElement>() |
|
|
|
|
|
|
|
|
|
|
|
const vModel = useVModel(props, 'modelValue', emits) |
|
|
|
const vModel = useVModel(props, 'modelValue', emits) |
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
const onSetRef = (el: HTMLInputElement) => { |
|
|
|
root.value?.focus() |
|
|
|
el.focus() |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
watch( |
|
|
|
|
|
|
|
() => root.value, |
|
|
|
|
|
|
|
(el) => { |
|
|
|
|
|
|
|
el?.focus() |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<input v-if="editEnabled" ref="root" v-model="vModel" class="h-full w-full outline-none" /> |
|
|
|
<input v-if="editEnabled" :ref="onSetRef" v-model="vModel" class="h-full w-full outline-none" /> |
|
|
|
<span v-else>{{ vModel }}</span> |
|
|
|
<span v-else>{{ vModel }}</span> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|