Skip to content

Warning about the Input component #5504

@wvq

Description

@wvq
  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

3.1.0

Environment

antdv 3.1.1

Reproduction link

Edit on CodeSandbox

Steps to reproduce

const inputProps = {
...otherProps,
...attrs,
autocomplete: autocomplete.value,
onChange: handleChange,
onInput: handleChange,
onFocus,
onBlur,
onKeydown: handleKeyDown,
class: classNames(
getInputClassName(prefixCls.value, bordered, size.value, disabled, direction.value),
{
[attrs.class as string]: attrs.class && !addonBefore && !addonAfter,
},
),
ref: inputRef,
key: 'ant-input',
size: htmlSize,
id: otherProps.id ?? formItemContext.id.value,
};
if (valueModifiers.lazy) {
delete inputProps.onInput;
}
if (!inputProps.autofocus) {
delete inputProps.autofocus;
}
const inputNode = <input {...inputProps} />;
return withDirectives(inputNode as VNode, [[antInputDirective]]);

If inputProps.size is a false value, like 0, null, undefined,
and pass it to <input {...inputProps} />.

A warning appears.

[Vue warn]: Failed setting prop "size" on : value 0 is invalid. DOMException: Failed to set the 'size' property on 'HTMLInputElement': The value provided is 0, which is an invalid size.

What is expected?

do not warning.

What is actually happening?

[Vue warn]: Failed setting prop "size" on : value 0 is invalid. DOMException: Failed to set the 'size' property on 'HTMLInputElement': The value provided is 0, which is an invalid size.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions