mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-14 22:33:17 +00:00
click event
This commit is contained in:
@@ -19,7 +19,9 @@ class WorkWeixinDepartmentsTreeNode extends Component {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleChildren = () => {
|
toggleChildren = (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
this.setState({
|
this.setState({
|
||||||
isChildrenShow: !this.state.isChildrenShow,
|
isChildrenShow: !this.state.isChildrenShow,
|
||||||
});
|
});
|
||||||
@@ -27,7 +29,7 @@ class WorkWeixinDepartmentsTreeNode extends Component {
|
|||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
if (this.props.index === 0) {
|
if (this.props.index === 0) {
|
||||||
this.toggleChildren();
|
this.setState({ isChildrenShow: true });
|
||||||
this.props.onChangeDepartment(this.props.department.id);
|
this.props.onChangeDepartment(this.props.department.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -61,9 +63,9 @@ class WorkWeixinDepartmentsTreeNode extends Component {
|
|||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
{isChildrenShow &&
|
{isChildrenShow &&
|
||||||
<div className={nodeInnerClass}>
|
<div className={nodeInnerClass} onClick={() => this.props.onChangeDepartment(department.id)}>
|
||||||
<i className={toggleClass} onClick={() => this.toggleChildren()}></i>{' '}
|
<i className={toggleClass} onClick={(e) => this.toggleChildren(e)}></i>{' '}
|
||||||
<span className="tree-node-text" onClick={() => this.props.onChangeDepartment(department.id)}>{department.name}</span>
|
<span className="tree-node-text">{department.name}</span>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
{this.state.isChildrenShow &&
|
{this.state.isChildrenShow &&
|
||||||
|
Reference in New Issue
Block a user