Skip to content

Commit

Permalink
fix:文档中广播效果失效问题&添加warning提示
Browse files Browse the repository at this point in the history
  • Loading branch information
hsm-lv committed Nov 5, 2023
1 parent 89791d5 commit a6af4d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/zh-CN/concepts/event-action.md
Original file line number Diff line number Diff line change
Expand Up @@ -2281,7 +2281,7 @@ run action ajax
},
{
type: 'form',
id: 'form_001_form_01',
id: 'form_001',
title: '表单1(优先级低)',
name: 'sub-form1',
body: [
Expand All @@ -2298,6 +2298,7 @@ run action ajax
actions: [
{
actionType: 'reload',
componentId: 'form_001',
data: {
myname: '${myrole}', // 从事件数据中取
}
Expand Down Expand Up @@ -2340,6 +2341,7 @@ run action ajax
actions: [
{
actionType: 'reload',
componentId: 'form_002',
data: {
myrole: '${myrole}',
age: '${age}'
Expand Down Expand Up @@ -2378,6 +2380,7 @@ run action ajax
actions: [
{
actionType: 'reload',
componentId: 'form_003',
data: {
job: '${myrole}'
}
Expand Down
5 changes: 5 additions & 0 deletions packages/amis-core/src/actions/CmptAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ export class CmptAction implements RendererAction {
const key = action.componentId || action.componentName;
const dataMergeMode = action.dataMergeMode || 'merge';

if (!key) {
console.warn('请提供目标组件的componentId或componentName');
return;
}

let component = key
? event.context.scoped?.[
action.componentId ? 'getComponentById' : 'getComponentByName'
Expand Down

0 comments on commit a6af4d2

Please sign in to comment.