Skip to content

Commit

Permalink
feat(editor): 方法参数支持选择数据源字段
Browse files Browse the repository at this point in the history
  • Loading branch information
roymondchen committed Jul 2, 2024
1 parent ecfaff2 commit 6cdeaa0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion packages/editor/src/components/CodeParams.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})),
),
);
/**
* 参数值修改更新
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/hooks/use-data-source-method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 6cdeaa0

Please sign in to comment.