道具类型失败:提供给“输入”的值“搜索”的无效道具“类型”

Failed prop type: Invalid prop `type` of value `search` supplied to `Input`

由于输入的类型="search",获取失败的道具类型。 说: "Failed prop type: Invalid prop type of value search supplied to Input, expected one of ["text","number","password","date","date-range","email","tel"]"

 <Input
   type="search"
   onChange={this.onSearchChange}
   iconSize={IconSize.xs}
   color="primary"
/>

type="search" 的输入按预期工作,但它一直给我控制台错误。任何人都知道为什么?以及如何修复它?

如果查看错误消息。 "Failed prop type: Invalid prop type of value search supplied to Input, expected one of ["text","number","password","date","date-range","email","tel"]

在您的代码中,您已将值 "search" 传递给输入组件的类型 属性。 基本上类型无法识别值 "search",因为它期望值是 "text"、"number"、"password"、"date"、"date-range"、"email" 或 "tel".

您的输入组件将正常工作,因为您在 onSearchChange 方法中编写了一些逻辑。

要修复此错误,请设置在 ["text"、"number"、"password"、"date"、"date-range"、"email","tel"].

例如。如果您仅使用文本进行搜索,请将其设置为 "text",对于数字,请将其设置为 "number" 等等。

<Input /> 是自定义组件。从评论中,您说这是您自己的组件。检查您的道具验证,因为目前它只允许 ["text","number","password","date","date-range","email","tel"].

您可以在验证中添加"search"