Tab事件

This commit is contained in:
wanghaoo 2018-12-24 16:09:25 +08:00
parent 9c652dd562
commit 27cf462d1d
6 changed files with 13 additions and 13 deletions

View File

@ -80,7 +80,7 @@ class Demo2 extends Component{
</TreeNode>
);
}
return <TreeNode key={item.key} title={item.key} />;
return <TreeNode key={item.key} title={item.key} isLeaf={true}/>;
});
return (
<Tree

File diff suppressed because one or more lines are too long

12
dist/demo.js vendored

File diff suppressed because one or more lines are too long

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -480,7 +480,7 @@ onExpand(treeNode,keyType) {
}
// all keyboard events callbacks run from here at first
onKeyDown(e,treeNode) {
event.preventDefault()
// event.preventDefault()
// console.log('-----'+e.keyCode);
const props = this.props;
const currentPos = treeNode.props.pos;
@ -494,10 +494,10 @@ onExpand(treeNode,keyType) {
}else if(e.keyCode == KeyCode.LEFT){
// 收起树节点
this.onExpand(treeNode,'left');
}else if (e.keyCode == KeyCode.RIGHT){
}else if (e.keyCode == KeyCode.RIGHT && !treeNode.props.isLeaf){
// 展开树节点
this.onExpand(treeNode,'right');
}else if (e.keyCode == KeyCode.SPACE && props.checkable){
}else if (e.keyCode == KeyCode.SPACE && props.checkable && !treeNode.props.isLeaf){
// 如果是多选tree则进行选中或者反选该节点
this.onCheck(treeNode);
}

View File

@ -168,7 +168,7 @@ class TreeNode extends React.Component {
// keyboard event support
onKeyDown(e) {
this.props.root.onKeyDown(e,this);
e.preventDefault();
// e.preventDefault();
}
renderSwitcher(props, expandedState) {