提交 9f9f0aa6 authored 作者: 钟是志's avatar 钟是志

tree 组件绑定value

上级 e7839b3a
...@@ -4,19 +4,11 @@ import { Tree } from 'antd'; ...@@ -4,19 +4,11 @@ import { Tree } from 'antd';
export default class TreeDiy extends React.Component { export default class TreeDiy extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
const allJson = props.option || {};
this.state = {
allJson,
};
} }
// static getDerivedStateFromProps(nextProps, prevState) {
// if ('value' in nextProps) {
// return { ...nextProps.value }; // 更新state
// }
// }
// componentDidUpdate(prevProps, prevState) {}
render() { render() {
return <Tree {...this.state.allJson} />; const {value, json} = this.props;
if (!value.treeData) return <div>...</div>;
return <Tree {...value} />;
} }
} }
...@@ -1733,13 +1733,12 @@ export default class TableCom extends Component { ...@@ -1733,13 +1733,12 @@ export default class TableCom extends Component {
} }
if (json.comName === 'Tree') { if (json.comName === 'Tree') {
if (!(this.state.option && this.state.option.treeData)) { console.log(this.state, this.props.form.getFieldsValue())
return <>无treeData配置项</>; return this.props.form.getFieldDecorator(uuid, {
} initialValue: '',
const xx = ( })(
<TreeDiy json={this.props.json} option={this.state.option} /> <TreeDiy json={this.props.json}/>
); )
return xx;
} }
// if([ // if([
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论