From d929217752aac2dcfcd56852c7dbc3a834819de1 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Thu, 17 Mar 2022 10:19:18 +0800 Subject: [PATCH] Fix Input.TextArea cut text logic when maxLength configured. --- components/input/ClearableLabeledInput.tsx | 9 ++- components/input/TextArea.tsx | 81 ++++++++++++++++++++-- components/input/demo/textarea.vue | 3 + components/input/inputProps.ts | 1 + 4 files changed, 86 insertions(+), 8 deletions(-) diff --git a/components/input/ClearableLabeledInput.tsx b/components/input/ClearableLabeledInput.tsx index 16724f679c..efcde5072b 100644 --- a/components/input/ClearableLabeledInput.tsx +++ b/components/input/ClearableLabeledInput.tsx @@ -33,6 +33,7 @@ export default defineComponent({ focused: PropTypes.looseBool, bordered: PropTypes.looseBool.def(true), triggerFocus: { type: Function as PropType<() => void> }, + hidden: Boolean, }, setup(props, { slots, attrs }) { const containerRef = ref(); @@ -91,6 +92,7 @@ export default defineComponent({ direction, readonly, bordered, + hidden, addonAfter = slots.addonAfter, addonBefore = slots.addonBefore, } = props; @@ -121,6 +123,7 @@ export default defineComponent({ class={affixWrapperCls} style={attrs.style} onMouseup={onInputMouseUp} + hidden={hidden} > {prefixNode} {cloneElement(element, { @@ -139,6 +142,7 @@ export default defineComponent({ addonAfter = slots.addonAfter?.(), size, direction, + hidden, } = props; // Not wrap when there is not addons if (!hasAddon({ addonBefore, addonAfter })) { @@ -169,7 +173,7 @@ export default defineComponent({ // Need another wrapper for changing display:table to display:inline-block // and put style prop in wrapper return ( - +