class Inputfield extends Component {
render() {
return (
<>
<label className={classNames('textfield-outlined', this.props.className)}>
<input
name={this.props.name}
value={this.props.value}
type={this.props.type}
placeholder=" "
onChange={this.props.onChange}
autoComplete={ this.props.autoComplete ? "on" : "off"}
/>
<span>{this.props.label}</span>
</label>
</>
);
}
}
Inputfield.defaultProps={
type:"text",
label:"Enter the name of field",
autoComplete: true,
}
Inputfield.propTypes={
name: PropTypes.string.isRequired,
type: PropTypes.string.isRequired,
label: PropTypes.string.isRequired,
className: PropTypes.string,
onChange: PropTypes.func,
autoComplete: PropTypes.bool
}
这是输入组件,如何处理这个组件中的autoFocus属性,它是作为props传递的?autoFocus="on" 或 "of"、autoFocus="true" 或 "false" 不起作用...!。tq 提前。