feat(editor): 方法参数支持选择数据源字段

This commit is contained in:
roymondchen 2024-07-02 16:16:15 +08:00
parent ecfaff2e0d
commit 6cdeaa0c1b
2 changed files with 12 additions and 2 deletions

View File

@ -44,7 +44,17 @@ const getFormConfig = (items: FormConfig = []) => [
},
];
const codeParamsConfig = computed(() => getFormConfig(props.paramsConfig));
const codeParamsConfig = computed(() =>
getFormConfig(
props.paramsConfig.map(({ name, text, extra, ...config }) => ({
type: 'data-source-field-select',
name,
text,
extra,
fieldConfig: config,
})),
),
);
/**
* 参数值修改更新

View File

@ -41,7 +41,7 @@ export const useDataSourceMethod = () => {
return;
}
let codeContent = method.content;
let codeContent = method.content || `({ params, dataSource, app }) => {\n // place your code here\n}`;
if (typeof codeContent !== 'string') {
codeContent = codeContent.toString();