From 0a28c9efc6d0b7bcb1605c8bd805eaa2623ad908 Mon Sep 17 00:00:00 2001 From: Alex Liu Date: Fri, 6 Sep 2024 17:56:27 +0800 Subject: [PATCH] fix(Textarea): resolve row count calculation errors caused by scrollbar (#2040) Co-authored-by: Romain Hamel --- src/runtime/components/forms/Textarea.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/runtime/components/forms/Textarea.vue b/src/runtime/components/forms/Textarea.vue index f38a76337f..1e78f054ac 100644 --- a/src/runtime/components/forms/Textarea.vue +++ b/src/runtime/components/forms/Textarea.vue @@ -154,6 +154,8 @@ export default defineComponent({ } textarea.value.rows = props.rows + const overflow = textarea.value.style.overflow + textarea.value.style.overflow = 'hidden' const styles = window.getComputedStyle(textarea.value) const paddingTop = parseInt(styles.paddingTop) @@ -166,6 +168,8 @@ export default defineComponent({ if (newRows > props.rows) { textarea.value.rows = props.maxrows ? Math.min(newRows, props.maxrows) : newRows } + + textarea.value.style.overflow = overflow } }