Merge pull request #5202 from z1769057083/master

fix: 修复drawer点击左上角取消动作无响应
This commit is contained in:
hsm-lv 2022-08-24 10:19:11 +08:00 committed by GitHub
commit 363f389ee6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -270,14 +270,18 @@ export default class Drawer extends React.Component<DrawerProps> {
return ret;
}
handleSelfClose() {
const {onClose, store} = this.props;
async handleSelfClose() {
const {onClose, store, dispatchEvent} = this.props;
// 如果有子弹框,那么就先不隐藏自己
if (store.dialogOpen !== false || store.drawerOpen !== false) {
return;
}
const rendererEvent = await dispatchEvent('cancel', this.props.data);
if (rendererEvent?.prevented) {
return;
}
// clear error
store.updateMessage();
onClose();