fix(components): [input] use v-if throw exception (#11187)

* fix(components): [input] use v-if throw exception

* fix(components): [input] remove the non-null assertion
This commit is contained in:
acyza
2023-02-05 19:35:32 +08:00
committed by GitHub
parent 6799618f79
commit 55bfb50a4d

View File

@@ -327,17 +327,17 @@ useResizeObserver(textarea, (entries) => {
const resizeTextarea = () => {
const { type, autosize } = props
if (!isClient || type !== 'textarea') return
if (!isClient || type !== 'textarea' || !textarea.value) return
if (autosize) {
const minRows = isObject(autosize) ? autosize.minRows : undefined
const maxRows = isObject(autosize) ? autosize.maxRows : undefined
textareaCalcStyle.value = {
...calcTextareaHeight(textarea.value!, minRows, maxRows),
...calcTextareaHeight(textarea.value, minRows, maxRows),
}
} else {
textareaCalcStyle.value = {
minHeight: calcTextareaHeight(textarea.value!).minHeight,
minHeight: calcTextareaHeight(textarea.value).minHeight,
}
}
}