diff --git a/packages/editor/src/components/CodeParams.vue b/packages/editor/src/components/CodeParams.vue index 7661af71..b48429a5 100644 --- a/packages/editor/src/components/CodeParams.vue +++ b/packages/editor/src/components/CodeParams.vue @@ -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, + })), + ), +); /** * 参数值修改更新 diff --git a/packages/editor/src/hooks/use-data-source-method.ts b/packages/editor/src/hooks/use-data-source-method.ts index 7020a1fa..444956fe 100644 --- a/packages/editor/src/hooks/use-data-source-method.ts +++ b/packages/editor/src/hooks/use-data-source-method.ts @@ -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();