mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-04 21:19:01 +08:00
commit
7bacf2df39
@ -115,6 +115,8 @@
|
||||
}
|
||||
|
||||
&.#{$ns}Drawer--noOverlay {
|
||||
pointer-events: none;
|
||||
|
||||
.#{$ns}Drawer-close svg {
|
||||
margin-top: px2rem(2px);
|
||||
width: px2rem(20px);
|
||||
|
@ -69,12 +69,14 @@ export class Drawer extends React.Component<DrawerProps, DrawerState> {
|
||||
if (this.props.show) {
|
||||
this.handleEntered();
|
||||
}
|
||||
document.body.addEventListener('click', this.handleRootClick);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
if (this.props.show) {
|
||||
this.handleExited();
|
||||
}
|
||||
document.body.removeEventListener('click', this.handleRootClick);
|
||||
}
|
||||
|
||||
contentRef = (ref: any) => (this.contentDom = ref);
|
||||
@ -105,7 +107,7 @@ export class Drawer extends React.Component<DrawerProps, DrawerState> {
|
||||
};
|
||||
|
||||
@autobind
|
||||
handleWidgetClick(e: React.MouseEvent) {
|
||||
handleRootClick(e: MouseEvent) {
|
||||
const {classPrefix: ns, closeOnOutside, onHide} = this.props;
|
||||
if ((e.target as HTMLElement).closest(`.${ns}Drawer-content`)) {
|
||||
return;
|
||||
@ -159,7 +161,7 @@ export class Drawer extends React.Component<DrawerProps, DrawerState> {
|
||||
},
|
||||
className
|
||||
)}
|
||||
onClick={this.handleWidgetClick} // 其实不需要插件,直接写逻辑吧
|
||||
// onClick={this.handleWidgetClick} // 其实不需要插件,直接写逻辑吧
|
||||
>
|
||||
{overlay ? (
|
||||
<div
|
||||
|
@ -141,6 +141,11 @@ export default class Drawer extends React.Component<DrawerProps, object> {
|
||||
handleSelfClose() {
|
||||
const {onClose, store} = this.props;
|
||||
|
||||
// 如果有子弹框,那么就先不隐藏自己
|
||||
if (store.dialogOpen !== false || store.drawerOpen !== false) {
|
||||
return;
|
||||
}
|
||||
|
||||
// clear error
|
||||
store.updateMessage();
|
||||
onClose();
|
||||
|
Loading…
Reference in New Issue
Block a user