From 7d7f0f326c2b6c40770ef9859c6cb83374b7d2a6 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Fri, 10 Dec 2021 16:29:04 +0800 Subject: [PATCH] feat: input & textarea support lazy dir #4951 close #4951 --- components/input/Input.tsx | 5 ++++- components/input/TextArea.tsx | 4 ++++ components/input/inputProps.ts | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/components/input/Input.tsx b/components/input/Input.tsx index 61e2b3ce1..79ea0cb71 100644 --- a/components/input/Input.tsx +++ b/components/input/Input.tsx @@ -172,9 +172,9 @@ export default defineComponent({ handleInputBlur, size, disabled, + valueModifiers = {}, $attrs, } = this; - const inputProps: any = { ...otherProps, ...$attrs, @@ -190,6 +190,9 @@ export default defineComponent({ onFocus: handleInputFocus, onBlur: handleInputBlur, }; + if (valueModifiers.lazy) { + delete inputProps.onInput; + } if (!inputProps.autofocus) { delete inputProps.autofocus; } diff --git a/components/input/TextArea.tsx b/components/input/TextArea.tsx index 544a49781..7c72b0580 100644 --- a/components/input/TextArea.tsx +++ b/components/input/TextArea.tsx @@ -16,6 +16,7 @@ const TextAreaProps = { showCount: PropTypes.looseBool, onCompositionstart: PropTypes.func, onCompositionend: PropTypes.func, + valueModifiers: Object, }; export default defineComponent({ @@ -127,6 +128,9 @@ export default defineComponent({ onChange: this.handleChange, onKeydown: this.handleKeyDown, }; + if (this.valueModifiers?.lazy) { + delete resizeProps.onInput; + } return (