From 763d04795beefd5abcfbe830c653e42a38510b0c Mon Sep 17 00:00:00 2001 From: wanghaoo Date: Sun, 27 Jan 2019 15:18:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A4=BA=E4=BE=8B1=EF=BC=8C?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8F=AF=E4=BB=A5=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E7=9A=84=E6=A0=91=E8=8A=82=E7=82=B9=E7=8A=B6?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/demolist/Demo1.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/demo/demolist/Demo1.js b/demo/demolist/Demo1.js index 04829ba..a6d65c6 100644 --- a/demo/demolist/Demo1.js +++ b/demo/demolist/Demo1.js @@ -23,20 +23,21 @@ class Demo1 extends Component { this.state = { defaultExpandedKeys: keys, defaultSelectedKeys: keys, - defaultCheckedKeys:keys - // checkedKeys: {checked:keys}, + defaultCheckedKeys:keys, + checkedKeys: {checked:keys}, }; } onSelect(info) { console.log('selected', info); } - onCheck = (checkedKeys) => { - let self = this; + onCheck = (checkedKeys,newst) => { + //用户可以自定义当前选中和半选中的节点。 console.log('onCheck', checkedKeys); const cks = { checked: checkedKeys.checked || checkedKeys, + halfChecked:checkedKeys.halfChecked }; - // this.setState({checkedKeys:cks}); + this.setState({checkedKeys:cks}); } onDoubleClick=(key,treeNode)=>{