chore(Input/InputNumber/PinInput/Textarea): clean functions order

This commit is contained in:
Benjamin Canac
2025-04-01 12:05:57 +02:00
parent ce767c8429
commit 4d8179ba08
4 changed files with 44 additions and 50 deletions

View File

@@ -87,12 +87,6 @@ const ui = computed(() => textarea({
const textareaRef = ref<HTMLTextAreaElement | null>(null)
function autoFocus() {
if (props.autofocus) {
textareaRef.value?.focus()
}
}
// Custom function to handle the v-model properties
function updateInput(value: string | null) {
if (modelModifiers.trim) {
@@ -140,18 +134,14 @@ function onBlur(event: FocusEvent) {
emits('blur', event)
}
onMounted(() => {
setTimeout(() => {
autoFocus()
}, props.autofocusDelay)
})
function autoFocus() {
if (props.autofocus) {
textareaRef.value?.focus()
}
}
function autoResize() {
if (props.autoresize) {
if (!textareaRef.value) {
return
}
if (props.autoresize && textareaRef.value) {
textareaRef.value.rows = props.rows
const overflow = textareaRef.value.style.overflow
textareaRef.value.style.overflow = 'hidden'
@@ -176,15 +166,19 @@ watch(modelValue, () => {
nextTick(autoResize)
})
defineExpose({
textareaRef
})
onMounted(() => {
setTimeout(() => {
autoFocus()
}, props.autofocusDelay)
setTimeout(() => {
autoResize()
}, 100)
})
defineExpose({
textareaRef
})
</script>
<template>