|
|
@ -11,26 +11,17 @@ const emits = defineEmits(['update:modelValue']) |
|
|
|
|
|
|
|
|
|
|
|
const editEnabled = inject<boolean>('editEnabled', false) |
|
|
|
const editEnabled = inject<boolean>('editEnabled', false) |
|
|
|
|
|
|
|
|
|
|
|
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> |
|
|
|
<textarea |
|
|
|
<textarea |
|
|
|
v-if="editEnabled" |
|
|
|
v-if="editEnabled" |
|
|
|
ref="root" |
|
|
|
:ref="onSetRef" |
|
|
|
v-model="vModel" |
|
|
|
v-model="vModel" |
|
|
|
rows="4" |
|
|
|
rows="4" |
|
|
|
class="h-full w-full min-h-[60px] outline-none" |
|
|
|
class="h-full w-full min-h-[60px] outline-none" |
|
|
@ -44,4 +35,4 @@ watch( |
|
|
|
textarea:focus { |
|
|
|
textarea:focus { |
|
|
|
@apply ring-transparent; |
|
|
|
@apply ring-transparent; |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |
|
|
|
</style> |