mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-16 01:40:53 +08:00
优化 redirect, 如果值是空就不跳转
This commit is contained in:
parent
e81f56782a
commit
fc61c5ffcd
@ -442,8 +442,8 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
||||
? this.reloadTarget(action.reload, data)
|
||||
: this.search({[pageField || 'page']: 1}, undefined, true);
|
||||
|
||||
action.redirect &&
|
||||
env.jumpTo(filter(action.redirect, data), action);
|
||||
const redirect = action.redirect && filter(action.redirect, data);
|
||||
redirect && env.jumpTo(redirect, action);
|
||||
})
|
||||
.catch(() => null);
|
||||
} else if (onAction) {
|
||||
@ -648,8 +648,8 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
||||
this.reloadTarget(dialogAction.reload, ctx);
|
||||
}
|
||||
|
||||
dialogAction.redirect &&
|
||||
env.jumpTo(filter(action.redirect, ctx), dialogAction);
|
||||
const redirect = dialogAction.redirect && filter(action.redirect, ctx);
|
||||
redirect && env.jumpTo(redirect, dialogAction);
|
||||
}
|
||||
|
||||
handleDialogClose() {
|
||||
|
@ -672,7 +672,11 @@ export default class Form extends React.Component<FormProps, object> {
|
||||
clearPersistDataAfterSubmit && store.clearPersistData();
|
||||
|
||||
if (action.redirect || redirect) {
|
||||
env.updateLocation(filter(action.redirect || redirect, store.data));
|
||||
const finalRedirect = filter(
|
||||
action.redirect || redirect,
|
||||
store.data
|
||||
);
|
||||
finalRedirect && env.jumpTo(finalRedirect, action);
|
||||
} else if (action.reload || reload) {
|
||||
this.reloadTarget(action.reload || reload, store.data);
|
||||
}
|
||||
@ -728,8 +732,10 @@ export default class Form extends React.Component<FormProps, object> {
|
||||
await this.openFeedback(action.feedback, store.data);
|
||||
}
|
||||
|
||||
action.redirect &&
|
||||
env.updateLocation(filter(action.redirect, store.data));
|
||||
const redirect =
|
||||
action.redirect && filter(action.redirect, store.data);
|
||||
redirect && env.jumpTo(redirect, action);
|
||||
|
||||
action.reload && this.reloadTarget(action.reload, store.data);
|
||||
})
|
||||
.catch(() => {});
|
||||
|
@ -228,8 +228,9 @@ export default class Page extends React.Component<PageProps> {
|
||||
await this.openFeedback(action.feedback, store.data);
|
||||
}
|
||||
|
||||
action.redirect &&
|
||||
env.jumpTo(filter(action.redirect, store.data), action);
|
||||
const redirect =
|
||||
action.redirect && filter(action.redirect, store.data);
|
||||
redirect && env.jumpTo(redirect, action);
|
||||
action.reload && this.reloadTarget(action.reload, store.data);
|
||||
})
|
||||
.catch(() => {});
|
||||
|
@ -227,8 +227,9 @@ export default class Service extends React.Component<ServiceProps> {
|
||||
await this.openFeedback(action.feedback, store.data);
|
||||
}
|
||||
|
||||
action.redirect &&
|
||||
env.jumpTo(filter(action.redirect, store.data), action);
|
||||
const redirect =
|
||||
action.redirect && filter(action.redirect, store.data);
|
||||
redirect && env.jumpTo(redirect, action);
|
||||
action.reload && this.reloadTarget(action.reload, store.data);
|
||||
})
|
||||
.catch(() => {});
|
||||
|
@ -391,11 +391,11 @@ export default class Wizard extends React.Component<WizardProps, WizardState> {
|
||||
await this.openFeedback(action.feedback, store.data);
|
||||
}
|
||||
|
||||
action.reload
|
||||
? this.reloadTarget(action.reload, store.data)
|
||||
: action.redirect
|
||||
? env.updateLocation(filter(action.redirect, store.data))
|
||||
: null;
|
||||
const reidrect =
|
||||
action.redirect && filter(action.redirect, store.data);
|
||||
reidrect && env.jumpTo(reidrect, action);
|
||||
|
||||
action.reload && this.reloadTarget(action.reload, store.data);
|
||||
})
|
||||
.catch(() => {});
|
||||
} else if (action.actionType === 'reload') {
|
||||
@ -552,8 +552,10 @@ export default class Wizard extends React.Component<WizardProps, WizardState> {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (redirect) {
|
||||
env.updateLocation(filter(redirect, store.data));
|
||||
const finalRedirect = redirect && filter(redirect, store.data);
|
||||
|
||||
if (finalRedirect) {
|
||||
env.jumpTo(finalRedirect, action);
|
||||
} else if (reload) {
|
||||
this.reloadTarget(reload, store.data);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user