# 接收外部传参 - order: 2 受控组件,外部传入参数,控制树对象节点 --- ````jsx var Tree = antd.Tree; var TreeNode = Tree.TreeNode; var Button = antd.Button; class TreeDemo extends React.Component { constructor(props) { super(props); ['handleClick', 'handleCheck', 'handleSelect'].forEach((m)=> { this[m] = this[m].bind(this); }); this.state = { checkedKeys: [], selectedKeys: [] } } handleClick() { this.setState({ checkedKeys: ['p11'], selectedKeys: ['p21', 'p11'] }) } handleCheck(info) { console.log('check: ', info); this.setState({ checkedKeys: ['p21'], selectedKeys: ['p1', 'p21'] }) } handleSelect(info) { console.log('selected: ', info); this.setState({ checkedKeys: ['p21'], selectedKeys: ['p21'] }) } render() { return (
test sss}/>
); } } React.render(, document.getElementById('components-tree-demo-special')); ````