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, handleInputBlur,
size, size,
disabled, disabled,
valueModifiers = {},
$attrs, $attrs,
} = this; } = this;
const inputProps: any = { const inputProps: any = {
...otherProps, ...otherProps,
...$attrs, ...$attrs,
@ -190,6 +190,9 @@ export default defineComponent({
onFocus: handleInputFocus, onFocus: handleInputFocus,
onBlur: handleInputBlur, onBlur: handleInputBlur,
}; };
if (valueModifiers.lazy) {
delete inputProps.onInput;
}
if (!inputProps.autofocus) { if (!inputProps.autofocus) {
delete inputProps.autofocus; delete inputProps.autofocus;
} }

4
components/input/TextArea.tsx

@ -16,6 +16,7 @@ const TextAreaProps = {
showCount: PropTypes.looseBool, showCount: PropTypes.looseBool,
onCompositionstart: PropTypes.func, onCompositionstart: PropTypes.func,
onCompositionend: PropTypes.func, onCompositionend: PropTypes.func,
valueModifiers: Object,
}; };
export default defineComponent({ export default defineComponent({
@ -127,6 +128,9 @@ export default defineComponent({
onChange: this.handleChange, onChange: this.handleChange,
onKeydown: this.handleKeyDown, onKeydown: this.handleKeyDown,
}; };
if (this.valueModifiers?.lazy) {
delete resizeProps.onInput;
}
return ( return (
<ResizableTextArea <ResizableTextArea
{...resizeProps} {...resizeProps}

1
components/input/inputProps.ts

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

Loading…
Cancel
Save