优化双击事件

This commit is contained in:
wanghaoo 2018-05-22 09:43:04 +08:00
parent d60f617cf9
commit 63afeeae11
5 changed files with 29 additions and 19 deletions

File diff suppressed because one or more lines are too long

2
dist/demo.css.map vendored

File diff suppressed because one or more lines are too long

29
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

@ -59,11 +59,16 @@ class TreeNode extends React.Component {
onSelect() {
clearTimeout(this.doubleClickFlag);
let _this = this;
if(this.props.onDoubleClick){
//执行延时
this.doubleClickFlag = setTimeout(function(){
//do function在此处写单击事件要执行的代码
_this.props.root.onSelect(_this);
},300);
this.doubleClickFlag = setTimeout(function(){
//do function在此处写单击事件要执行的代码
_this.props.root.onSelect(_this);
},300);
}else{
_this.props.root.onSelect(_this);
}
}