ant-design/components/tree/index.jsx

30 lines
661 B
React
Raw Normal View History

2015-08-03 16:07:21 +08:00
import React from 'react';
2015-08-03 16:11:56 +08:00
import Tree from 'rc-tree';
2015-08-25 11:11:21 +08:00
import animation from '../common/openAnimation';
const AntTree = React.createClass({
2015-08-05 17:38:02 +08:00
getDefaultProps() {
return {
2015-08-19 12:18:10 +08:00
prefixCls: 'ant-tree',
checkable: false,
showIcon: false,
2016-01-07 19:05:55 +08:00
openAnimation: animation,
2015-08-05 17:38:02 +08:00
};
},
2015-08-03 16:07:21 +08:00
render() {
2015-08-19 12:18:10 +08:00
const props = this.props;
let checkable = props.checkable;
if (checkable) {
checkable = <span className={`${props.prefixCls}-checkbox-inner`}></span>;
}
return (
<Tree {...props} checkable={checkable}>
{this.props.children}
</Tree>
);
2015-08-03 16:07:21 +08:00
}
});
AntTree.TreeNode = Tree.TreeNode;
export default AntTree;