mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:39:05 +08:00
fix: 修复弹窗可多次点击问题 (#5284)
This commit is contained in:
parent
4cbb23b5aa
commit
478aef0fdb
@ -396,8 +396,8 @@ export class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
|
||||
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,
|
||||
|
@ -245,18 +245,19 @@ export default class Dialog extends React.Component<DialogProps> {
|
||||
handleActionSensor(p: Promise<any>) {
|
||||
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;
|
||||
|
@ -291,15 +291,16 @@ export default class Drawer extends React.Component<DrawerProps> {
|
||||
handleActionSensor(p: Promise<any>) {
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user