fix:ajax动作responseData配置失效问题

This commit is contained in:
lvxiaojiao 2023-01-09 18:51:20 +08:00
parent de7d67981e
commit 810dc89989
3 changed files with 9 additions and 5 deletions

View File

@ -259,7 +259,10 @@ run action ajax
args: {
api: {
url: 'https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/form/saveForm?name=${name}',
method: 'get'
method: 'get',
"responseData": {
"resId": "${id}"
}
},
messages: {
success: '成功了!欧耶',

View File

@ -186,7 +186,7 @@ export const runAction = async (
event
};
// $$默认为renderer.props.data兼容表单项值变化时的data读取
// __rendererData默认为renderer.props.data兼容表单项值变化时的data读取
if (!event.data.__rendererData) {
additional = {
event,
@ -223,7 +223,9 @@ export const runAction = async (
// 动作配置
const args = dataMapping(actionConfig.args, mergeData, key =>
['adaptor', 'responseAdaptor', 'requestAdaptor'].includes(key)
['adaptor', 'responseAdaptor', 'requestAdaptor', 'responseData'].includes(
key
)
);
const afterMappingData = dataMapping(actionConfig.data, mergeData);

View File

@ -1,4 +1,3 @@
import omit from 'lodash/omit';
import {Api, ApiObject} from '../types';
import {normalizeApiResponseData} from '../utils/api';
import {ServerError} from '../utils/errors';
@ -54,7 +53,7 @@ export class AjaxAction implements RendererAction {
const env = event.context.env;
try {
const result = await env.fetcher(
action.args?.api as string,
action.args?.api,
action.data ?? {},
action.args?.options ?? {}
);