Skip to content

Commit

Permalink
feat: input & textarea support lazy dir #4951
Browse files Browse the repository at this point in the history
close #4951
  • Loading branch information
tangjinzhou committed Dec 10, 2021
1 parent 6c28a8e commit 7d7f0f3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ export default defineComponent({
handleInputBlur,
size,
disabled,
valueModifiers = {},
$attrs,
} = this;

const inputProps: any = {
...otherProps,
...$attrs,
Expand All @@ -190,6 +190,9 @@ export default defineComponent({
onFocus: handleInputFocus,
onBlur: handleInputBlur,
};
if (valueModifiers.lazy) {
delete inputProps.onInput;
}
if (!inputProps.autofocus) {
delete inputProps.autofocus;
}
Expand Down
4 changes: 4 additions & 0 deletions components/input/TextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const TextAreaProps = {
showCount: PropTypes.looseBool,
onCompositionstart: PropTypes.func,
onCompositionend: PropTypes.func,
valueModifiers: Object,
};

export default defineComponent({
Expand Down Expand Up @@ -127,6 +128,9 @@ export default defineComponent({
onChange: this.handleChange,
onKeydown: this.handleKeyDown,
};
if (this.valueModifiers?.lazy) {
delete resizeProps.onInput;
}
return (
<ResizableTextArea
{...resizeProps}
Expand Down
1 change: 1 addition & 0 deletions components/input/inputProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ export default {
onChange: PropTypes.func,
onInput: PropTypes.func,
'onUpdate:value': PropTypes.func,
valueModifiers: Object,
};

0 comments on commit 7d7f0f3

Please sign in to comment.