fix: stop propatation when cliking or checking a node
This commit is contained in:
parent
35d394215d
commit
09b9d18e58
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -177,6 +177,12 @@ class TreeNode extends React.Component {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onStopPropagation = event => {
|
||||||
|
if (event) {
|
||||||
|
event.stopPropagation()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
renderSwitcher(props, expandedState) {
|
renderSwitcher(props, expandedState) {
|
||||||
let stateIcon;
|
let stateIcon;
|
||||||
const prefixCls = props.prefixCls;
|
const prefixCls = props.prefixCls;
|
||||||
|
@ -206,7 +212,7 @@ class TreeNode extends React.Component {
|
||||||
switcherCls[`${prefixCls}-switcher-disabled`] = true;
|
switcherCls[`${prefixCls}-switcher-disabled`] = true;
|
||||||
return <span className={classNames(switcherCls)} style={props.switcherStyle}>{stateIcon}</span>;
|
return <span className={classNames(switcherCls)} style={props.switcherStyle}>{stateIcon}</span>;
|
||||||
}
|
}
|
||||||
return <span className={classNames(switcherCls)} style={props.switcherStyle} onClick={this.onExpand}>{stateIcon}</span>;
|
return <span className={classNames(switcherCls)} style={props.switcherStyle} onMouseDown={this.onStopPropagation} onClick={this.onExpand}>{stateIcon}</span>;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderCheckbox(props) {
|
renderCheckbox(props) {
|
||||||
|
@ -228,9 +234,10 @@ class TreeNode extends React.Component {
|
||||||
return <span className={classNames(checkboxCls)}>{customEle}</span>;
|
return <span className={classNames(checkboxCls)}>{customEle}</span>;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<span
|
<span
|
||||||
className={classNames(checkboxCls) }
|
className={classNames(checkboxCls) }
|
||||||
onClick={this.onCheck}
|
onClick={this.onCheck}
|
||||||
|
onMouseDown={this.onStopPropagation}
|
||||||
>{customEle}</span>);
|
>{customEle}</span>);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue