eduPfsSelect.jsx 779 B

12345678910111213141516171819202122232425262728293031
  1. import React from 'react';
  2. import { Cascader } from 'antd';
  3. import { eduPfsList } from '../../DicPfsList.js';
  4. const eduPfsSelect = React.createClass({
  5. getInitialState() {
  6. return {
  7. value: [],
  8. propsbool: true
  9. }
  10. },
  11. onChange(v, s) {
  12. this.setState({
  13. value: v
  14. })
  15. this.props.Professional(v[0], v[1]);
  16. },
  17. componentWillReceiveProps(nextProps) {
  18. if (nextProps.defValue && this.state.propsbool) {
  19. this.state.value = nextProps.defValue;
  20. this.state.propsbool = false;
  21. };
  22. },
  23. render() {
  24. return (
  25. <Cascader value={this.state.value} options={eduPfsList} onChange={this.onChange} />
  26. )
  27. }
  28. });
  29. export default eduPfsSelect;