mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 20:18:03 +08:00
Merge pull request #637 from RickCole21/master
Drawer 有 overlay 时,配置 closeOnOutside 失效
This commit is contained in:
commit
f6e7259287
@ -111,20 +111,19 @@ export class Drawer extends React.Component<DrawerProps, DrawerState> {
|
||||
@autobind
|
||||
handleRootClickCapture(e: MouseEvent) {
|
||||
const target = e.target as HTMLElement;
|
||||
const closeOnOutside = this.props.closeOnOutside;
|
||||
const {closeOnOutside, classPrefix: ns} = this.props;
|
||||
const isLeftButton =
|
||||
(e.button === 1 && window.event !== null) || e.button === 0;
|
||||
|
||||
this.isRootClosed = !!(
|
||||
(
|
||||
isLeftButton &&
|
||||
closeOnOutside &&
|
||||
target &&
|
||||
this.modalDom &&
|
||||
!this.modalDom.contains(target) &&
|
||||
!target.closest('[role=dialog]')
|
||||
) // 干脆过滤掉来自弹框里面的点击
|
||||
);
|
||||
isLeftButton &&
|
||||
closeOnOutside &&
|
||||
target &&
|
||||
this.modalDom &&
|
||||
((!this.modalDom.contains(target) && !target.closest('[role=dialog]')) ||
|
||||
(target.matches(`.${ns}Drawer-overlay`) &&
|
||||
target.parentElement === this.modalDom))
|
||||
); // 干脆过滤掉来自弹框里面的点击
|
||||
}
|
||||
|
||||
@autobind
|
||||
|
Loading…
Reference in New Issue
Block a user