diff --git a/packages/amis-editor/src/renderer/event-control/actions.tsx b/packages/amis-editor/src/renderer/event-control/actions.tsx index a286bdc2f..04749f682 100644 --- a/packages/amis-editor/src/renderer/event-control/actions.tsx +++ b/packages/amis-editor/src/renderer/event-control/actions.tsx @@ -656,7 +656,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => { ); }, - supportComponents: [], + supportComponents: 'byComponent', schema: renderCmptSelect('选择组件', true) }, { @@ -681,7 +681,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => { ); }, - supportComponents: [], + supportComponents: 'byComponent', schema: [ ...renderCmptActionSelect('选择组件', true), getArgsWrapper({ diff --git a/packages/amis-editor/src/renderer/event-control/helper.tsx b/packages/amis-editor/src/renderer/event-control/helper.tsx index d1718c3d2..ba636c19c 100644 --- a/packages/amis-editor/src/renderer/event-control/helper.tsx +++ b/packages/amis-editor/src/renderer/event-control/helper.tsx @@ -992,12 +992,14 @@ export const getEventControlConfig = ( isSupport = action.supportComponents === '*' || action.supportComponents === node.type; + // 内置逻辑 + if (action.supportComponents === 'byComponent') { + isSupport = hasActionType(actionType, actions); + } } else if (Array.isArray(action.supportComponents)) { isSupport = action.supportComponents.includes(node.type); } - if (['reload', 'setValue'].includes(actionType)) { - isSupport = hasActionType(actionType, actions); - } + if (actionType === 'component' && !actions?.length) { node.disabled = true; }