Skip to content

Warning about the Input component #5503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wvq opened this issue Apr 15, 2022 · 3 comments
Closed

Warning about the Input component #5503

wvq opened this issue Apr 15, 2022 · 3 comments

Comments

@wvq
Copy link

wvq commented Apr 15, 2022

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]]);

inputProps.size 如果为0或者undefined等任意 false 值, 传递给 <input {...inputProps} />
会报一个warning

[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.

建议处理一下,开发起来控制台一大堆 warning, 影响很大。

@github-actions
Copy link

Hello @wvq, your issue has been closed because it does not conform to our issue requirements. Please use the Issue Helper to create an issue, thank you!

你好 @wvq,为了能够进行高效沟通,我们对 issue 有一定的格式要求,你的 issue 因为不符合要求而被自动关闭。你可以通过 issue 助手 来创建 issue 以方便我们定位错误。谢谢配合!

@github-actions github-actions bot changed the title 关于Input组件的warning Warning about the Input component Apr 15, 2022
@close-issue-app
Copy link

Your issue has been closed because it does not conform to our issue requirements. Please use the Issue Helper to create an issue, thank you!

为了能够进行高效沟通,我们对 issue 有一定的格式要求,你的 issue 因为不符合要求而被自动关闭。你可以通过 issue 助手 来创建 issue 以方便我们定位错误。谢谢配合!

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant