帮我找出原因,为什么我在此输入时输入文本没有接受任何输入,下面是代码。
预先感谢,感谢您的回答
import './login.css';
import {connect} from 'react-redux'
import TextField from '@material-ui/core/TextField';
import Button from '@material-ui/core/Button';
import React,{Component} from 'react';
// import Alert from 'react-s-alert';
import {Field, reduxForm, reset, change} from 'redux-form';
export const renderTextField = ({
input,
label,
id,
multiLine,
rowsMax,
fullWidth,
disabled,
hintText,
defaultValue,
onChange,
maxLength,
loader,
meta: { touched, error },
customError,
autoFocus,
floatingLabelFixed,
...custom
}) => {
return (
<TextField
id={id}
defaultValue={defaultValue}
autoFocus={autoFocus}
floatingLabelText={label}
floatingLabelFixed={floatingLabelFixed}
errorText={touched && (error || customError)}
multiLine={multiLine}
hintText={hintText}
rowsMax={rowsMax}
disabled={disabled}
fullWidth={true}
className="valuefont"
autoComplete='new-type'
onChange={(event) => onChange}
maxLength={maxLength}
floatingLabelStyle={{ top: '30px', color: '#7a7a7a' }}
floatingLabelFocusStyle={{ color: '#01B9C1' }}
style={{ height: '62px ' }}
inputStyle={{ marginTop: '10px' }}
{...input}
{...custom}
/>
);
};
export class Login extends Component {
constructor() {
super();
this.state = ({
});
this.onSubmit = this.onSubmit.bind(this);
}
componentWillMount(){
let masterData = {masterData: 'masterLocation'};
// this.props.getMasterData(masterData);
}
onSubmit(formData){
debugger;
}
render() {
const { handleSubmit } = this.props;
return (
<div>
<div className="readmin-panel">
<div className="page_header col-12">
<div className="row">
<div className="col-sm-12 text-right useful_btns">
<h2 className="page_title">Customized Components</h2>
</div>
</div>
</div>
<div className="panel-body">
<form className="readmin-form custom_form" onSubmit={handleSubmit(this.onSubmit.bind(this))}>
<div className="row p-2">
<div className="col-sm-4 col-md-4 mt-30">
<Field
name="name"
label="name"
// onChange = {(e)=>{console.log(e.target.value)}}
component={renderTextField}/>
</div>
</div>
<button type="submit"className="btn btn-primary">submit</button>
</form>
</div>
</div>
</div>
);
}
}
function mapStateToProps(state) {
return null;
}
Login = reduxForm({
form: 'editForm'
})(Login)
export default connect(mapStateToProps, {})(Login);