改成捕获时期

This commit is contained in:
2betop 2020-05-09 09:43:30 +08:00
parent aa6d38600b
commit 3fb4114461

View File

@ -69,14 +69,14 @@ export class Drawer extends React.Component<DrawerProps, DrawerState> {
if (this.props.show) {
this.handleEntered();
}
document.body.addEventListener('click', this.handleRootClick);
document.body.addEventListener('click', this.handleRootClick, true);
}
componentWillUnmount() {
if (this.props.show) {
this.handleExited();
}
document.body.removeEventListener('click', this.handleRootClick);
document.body.removeEventListener('click', this.handleRootClick, true);
}
contentRef = (ref: any) => (this.contentDom = ref);