【发布时间】:2019-10-01 16:23:19
【问题描述】:
我正在尝试将 maxLength 作为道具传递给,但它不起作用。任何人都可以帮忙吗?谢谢!
以下是两个组件:
<Input
id="creategroup-group-and-description-textfield"
value={value}
type="text"
multiline={this.props.multiline}
rowsMax={this.props.rowsMax}
maxLength={this.props.maxLength}
onChange={this.handleInputChange}
placeholder={this.props.placeholder}
/>
<TextFieldWithTitle
title="Group Name"
maxLength={3}
multiline={false}
placeholder="e.g.Study and Workout"
/>
【问题讨论】:
-
你能分享你的2个组件的代码吗?
-
嗨!考虑将代码 sn-ps 添加到您的问题而不是他们的图像中。
-
我分享了上面的代码
-
Input和TextFieldWithTitle是什么?样式化的组件?你自己的组件?还是什么? -
TextFieldWithTitle 是我定义的组件。 是 Material UI 中的组件。这两个组件位于不同的文件中。 位于 TextFieldwithTitle 的渲染部分,它是另一个主组件的子组件。我在主组件文件中调用了 TextFieldWithTitle .. 将道具传回子组件文件
标签: reactjs input react-props maxlength