ssc-grid
Version:
React grid component for SSC 3.0
40 lines (38 loc) • 980 B
JavaScript
import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
/**
* MonthBox 只提供给MonthPicker组件使用
*/
var MonthBox = createReactClass({
displayName: 'MonthBox',
propTypes: {
value: PropTypes.string,
onClick: PropTypes.func
},
getInitialState: function getInitialState() {
return {
value: this.props.value || ''
};
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
this.setState({
value: nextProps.value || ''
});
},
handleClick: function handleClick(event) {
if (this.props.onClick) {
this.props.onClick(event);
}
},
render: function render() {
return React.createElement(
'div',
{ className: 'box', onClick: this.handleClick },
React.createElement('input', { type: 'text', value: this.state.value,
onChange: function onChange() {}
})
);
}
});
export default MonthBox;