From 5b7e5c6f94e2dd7e2df7b3c79af97de323e3fb6f Mon Sep 17 00:00:00 2001 From: zhangxulong Date: Mon, 22 Aug 2022 23:41:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Ddrawer=E7=82=B9?= =?UTF-8?q?=E5=87=BBX=E8=87=AA=E5=AE=9A=E4=B9=89=E5=8A=A8=E4=BD=9C?= =?UTF-8?q?=E6=97=A0=E5=93=8D=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis/src/renderers/Drawer.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/amis/src/renderers/Drawer.tsx b/packages/amis/src/renderers/Drawer.tsx index 03e470b42..752ca0759 100644 --- a/packages/amis/src/renderers/Drawer.tsx +++ b/packages/amis/src/renderers/Drawer.tsx @@ -270,14 +270,18 @@ export default class Drawer extends React.Component { 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();