diff --git a/packages/amis-core/src/SchemaRenderer.tsx b/packages/amis-core/src/SchemaRenderer.tsx index 614fa5736..878522fc5 100644 --- a/packages/amis-core/src/SchemaRenderer.tsx +++ b/packages/amis-core/src/SchemaRenderer.tsx @@ -396,8 +396,8 @@ export class SchemaRenderer extends React.Component { let props = { ...theme.getRendererConfig(renderer.name), ...restSchema, - ...chainEvents(rest, restSchema), ...exprProps, + ...chainEvents(rest, restSchema), // value: defaultValue, // 备注: 此处并没有将value传递给渲染器 defaultData: restSchema.defaultData ?? defaultData, defaultValue: restSchema.defaultValue ?? defaultValue, diff --git a/packages/amis/src/renderers/Dialog.tsx b/packages/amis/src/renderers/Dialog.tsx index d39ae7704..96b88faae 100644 --- a/packages/amis/src/renderers/Dialog.tsx +++ b/packages/amis/src/renderers/Dialog.tsx @@ -245,18 +245,19 @@ export default class Dialog extends React.Component { handleActionSensor(p: Promise) { const {store} = this.props; + const origin = store.busying; store.markBusying(true); // clear error store.updateMessage(); p.then(() => { - store.markBusying(false); + store.markBusying(origin); }).catch(e => { if (this.isDead) { return; } store.updateMessage(e.message, true); - store.markBusying(false); + store.markBusying(origin); }); } @@ -730,6 +731,9 @@ export class DialogRenderer extends Dialog { } if (targets.length) { + store.markBusying(true); + store.updateMessage(); + Promise.all( targets.map(target => target.doAction( @@ -755,10 +759,14 @@ export class DialogRenderer extends Dialog { ? this.handleSelfClose() : this.closeTarget(action.close); } + store.markBusying(false); }) .catch(reason => { + if (this.isDead) { + return; + } store.updateMessage(reason.message, true); - throw reason; + store.markBusying(false); }); return true; diff --git a/packages/amis/src/renderers/Drawer.tsx b/packages/amis/src/renderers/Drawer.tsx index 54bc78d5b..019d2995a 100644 --- a/packages/amis/src/renderers/Drawer.tsx +++ b/packages/amis/src/renderers/Drawer.tsx @@ -291,15 +291,16 @@ export default class Drawer extends React.Component { handleActionSensor(p: Promise) { const {store} = this.props; + const origin = store.busying; store.markBusying(true); // clear error store.updateMessage(); p.then(() => { - store.markBusying(false); + store.markBusying(origin); }).catch(e => { store.updateMessage(e.message, true); - store.markBusying(false); + store.markBusying(origin); }); } @@ -734,6 +735,9 @@ export class DrawerRenderer extends Drawer { } if (targets.length) { + store.markBusying(true); + store.updateMessage(); + Promise.all( targets.map(target => target.doAction( @@ -759,10 +763,11 @@ export class DrawerRenderer extends Drawer { ? this.handleSelfClose() : this.closeTarget(action.close); } + store.markBusying(false); }) .catch(reason => { store.updateMessage(reason.message, true); - throw reason; + store.markBusying(false); }); return true;