feat: input & textarea support lazy dir #4951

close #4951
pull/5026/head
tangjinzhou 2021-12-10 16:29:04 +08:00
parent 6c28a8e40c
commit 7d7f0f326c
3 changed files with 9 additions and 1 deletions

View File

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

View File

@ -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}

View File

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