Browse Source

feat: input & textarea support lazy dir #4951

close #4951
pull/5026/head
tangjinzhou 3 years ago
parent
commit
7d7f0f326c
  1. 5
      components/input/Input.tsx
  2. 4
      components/input/TextArea.tsx
  3. 1
      components/input/inputProps.ts

5
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;
}

4
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 (
<ResizableTextArea
{...resizeProps}

1
components/input/inputProps.ts

@ -32,4 +32,5 @@ export default {
onChange: PropTypes.func,
onInput: PropTypes.func,
'onUpdate:value': PropTypes.func,
valueModifiers: Object,
};

Loading…
Cancel
Save