mirror of
https://github.com/tengge1/ShadowEditor.git
synced 2026-01-25 15:08:11 +00:00
搜索框。
This commit is contained in:
parent
189477381a
commit
aa1a107dff
@ -1,6 +1,7 @@
|
||||
import classNames from 'classnames/bind';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import SearchField from '../../form/SearchField.jsx';
|
||||
import ImageList from '../../image/ImageList.jsx';
|
||||
|
||||
/**
|
||||
@ -9,7 +10,10 @@ import ImageList from '../../image/ImageList.jsx';
|
||||
*/
|
||||
class ScenePanel extends React.Component {
|
||||
render() {
|
||||
return <ImageList></ImageList>;
|
||||
return <div className={'ScenePanel'}>
|
||||
<SearchField></SearchField>
|
||||
<ImageList></ImageList>
|
||||
</div>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,64 @@
|
||||
import './css/Input.css';
|
||||
import classNames from 'classnames/bind';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
/**
|
||||
* 搜索框
|
||||
* @author tengge / https://github.com/tengge1
|
||||
*/
|
||||
class SearchField extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
value: props.value,
|
||||
};
|
||||
|
||||
this.handleChange = this.handleChange.bind(this, props.onChange);
|
||||
this.handleInput = this.handleInput.bind(this, props.onInput);
|
||||
}
|
||||
|
||||
handleChange(onChange, event) {
|
||||
this.setState({
|
||||
value: event.target.value,
|
||||
});
|
||||
onChange && onChange(event.target.value, event);
|
||||
}
|
||||
|
||||
handleInput(onInput, event) {
|
||||
this.setState({
|
||||
value: event.target.value,
|
||||
});
|
||||
onInput && onInput(event.target.value, event);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { className, style, value, onChange, onInput, ...others } = this.props;
|
||||
|
||||
return <input
|
||||
className={classNames('Input', className)}
|
||||
style={style}
|
||||
value={this.state.value}
|
||||
onChange={this.handleChange}
|
||||
onInput={this.handleInput}
|
||||
{...others} />;
|
||||
}
|
||||
}
|
||||
|
||||
SearchField.propTypes = {
|
||||
className: PropTypes.string,
|
||||
style: PropTypes.object,
|
||||
value: PropTypes.string,
|
||||
onChange: PropTypes.func,
|
||||
onInput: PropTypes.func,
|
||||
};
|
||||
|
||||
SearchField.defaultProps = {
|
||||
className: null,
|
||||
style: null,
|
||||
value: '',
|
||||
onChange: null,
|
||||
onInput: null,
|
||||
};
|
||||
|
||||
export default SearchField;
|
||||
Loading…
x
Reference in New Issue
Block a user