import React from 'react';
import Top from './top';
import Left from './left';
import Content from './conent';
import './c.less';
class Main extends React.Component {
constructor(props) {
super(props);
this.state = {
leftcheck: false,
};
}
getChildrenMsg = (result, msg) => {
this.setState({
leftcheck: msg,
});
};
render() {
const { leftcheck } = this.state;
const topprops = {};
const leftprops = {
leftcheck,
left: 1,
};
const contprops = {};
return (
<div className="bb">
<div className="top">
<Top {...topprops} />
</div>
<div className="zz">
<div className="left">
<Left parent={this} />
</div>
<div className="content">
<Content xdinfo={leftprops} />
</div>
</div>
</div>
);
}
}
export default Main;
import { CheckBox } from 'choerodon-ui/pro';
import React from 'react';
class Left extends React.Component {
constructor(props) {
super(props);
const { leftcheck, left } = props;
console.log(left, leftcheck, 'left');
this.state = {};
}
render() {
const toParent = () => {
this.props.parent.getChildrenMsg(this, this.state.msg);
};
const handleChange = val => {
console.log(val);
this.props.parent.getChildrenMsg(this, val);
};
return (
<div>
<CheckBox name="base" onChange={handleChange}>
A
</CheckBox>
</div>
);
}
}
export default Left;
import React from 'react';
const content = props => {
const { xdinfo } = props;
return <div>{xdinfo.leftcheck ? 1111 : 2222}</div>;
};
export default content;```
|