diff --git a/components/tree/demo/checkbox.md b/components/tree/demo/checkbox.md index dbc38f1e17..24ae816562 100644 --- a/components/tree/demo/checkbox.md +++ b/components/tree/demo/checkbox.md @@ -1,4 +1,4 @@ -# 基本 +# 复选框 - order: 1 @@ -9,12 +9,15 @@ ````jsx var Tree = antd.Tree; var TreeNode = Tree.TreeNode; -function handleCheck(checked, c, checkedKeys) { - console.log('checked: ', checked, c ); +function handleCheck(info) { + console.log('check: ', info); +} +function handleSelect(info) { + console.log('select: ', info); } React.render( - } onCheck={handleCheck}> + leaf diff --git a/components/tree/index.jsx b/components/tree/index.jsx index 8af1b333c8..c7d069df27 100644 --- a/components/tree/index.jsx +++ b/components/tree/index.jsx @@ -4,11 +4,18 @@ import Tree from 'rc-tree'; const AntTree = React.createClass({ getDefaultProps() { return { - prefixCls: 'ant-tree' + prefixCls: 'ant-tree', + checkable: false, + showIcon: false, }; }, render() { - return + const props = this.props; + let checkable = props.checkable; + if (checkable) { + checkable = ; + } + return {this.props.children} ; } diff --git a/components/tree/index.md b/components/tree/index.md index ee00c057e3..1f678f8c47 100644 --- a/components/tree/index.md +++ b/components/tree/index.md @@ -15,11 +15,14 @@ | 参数 | 说明 | 类型 | 默认值 | |-----------|------------------------------------------|------------|--------| -|checkable | 是否支持选中 | bool/React Node | false | +|multiple | 是否支持多选 | bool | false | +|checkable | 是否支持选中 | bool | false | |defaultExpandAll | 设置展开所有树节点 | bool | false | |defaultExpandedKeys | 展开指定的树节点 | String[] | false | -|defaultCheckedKeys | 默认选中的树节点 | String[] | [] | -|onCheck | 点击树节点触发 | function(e:{checked:bool,node,checkedKeys}) | - | +|defaultCheckedKeys | 默认选中复选框的树节点 | String[] | [] | +|defaultSelectedKeys | 默认选中的树节点 | String[] | [] | +|onCheck | 点击树节点或复选框触发 | function(e:{checked:bool,node,checkedKeys,event}) | - | +|onSelect | 点击树节点触发 | function(e:{selected:bool,node,checkedKeys,event}) | - | ### TreeNode props diff --git a/style/components/tree.less b/style/components/tree.less index 42cfcddd2f..9041971c72 100644 --- a/style/components/tree.less +++ b/style/components/tree.less @@ -42,6 +42,9 @@ color: #666; } span { + &.@{treePrefixCls}-checkbox { + margin: 3px 7px 0 0; + } &.@{treePrefixCls}-switcher, &.@{treePrefixCls}-iconEle { line-height: 0;