UNPKG

react-admin-lte

Version:

简单封装的 AdminLTE react 类库,并包含一个编译配置。

41 lines (37 loc) 1.17 kB
import React from 'react'; import InputBase from './InputBase'; export default class InputText extends React.Component { constructor(props, context) { super(props, context); this.onChange = this.onChange.bind(this); } onChange(e) { if (this.props.onValueChange) { this.props.onValueChange(this.props.name, e.target.value); } if (this.props.onChange) { this.props.onChange(e); } } render() { return <InputBase label={this.props.label} name={this.props.name}> { this.props.rows && this.props.rows > 1 ? <textarea className="form-control" id={this.props.name} rows={this.props.rows} name={this.props.name} placeholder={this.props.label} value={this.props.value} onChange={this.onChange}/> : <input className="form-control" id={this.props.name} type={this.props.type} name={this.props.name} placeholder={this.props.label} value={this.props.value} onChange={this.onChange} readOnly={this.props.readOnly} /> } </InputBase>; } }