amis icon indicating copy to clipboard operation
amis copied to clipboard

amis-editor中自定义combo plugin,右侧面板中的select选中事件如何能修改combo的内容?

Open hugo8680 opened this issue 4 months ago • 2 comments

实现场景:

在amis-editor中,我实现了一个自定义combo组件,combo组件右侧面板中带有一个数据源下拉框,当下拉框修改触发change事件时,将自定义combo组件的items修改为我选择的选项值

存在的问题:

没有找到方法实现

当前方案:

请粘贴你当前方案的完整 amis schema 代码...

panelBodyCreator中的配置:

getSchemaTpl('select', {
                  required: true,
                  label: tipedLabel('字段名称', '必填:可从已配置好的子表名称中选择一个,如果需要增加子表名称,请在管理后台表单数据源<span style="color:orange">子表名称</span>中增加'),
                  name: 'name',
                  type: 'select',
                  searchable: true,
                  source: '/api/form/formDataSource/list?code=form_sub_table_name',
                  "onEvent": {
                    "change": {
                      "actions": [
                        {
                          "actionType": "setValue",
                          "componentId": "title",



                          "args": {
                            "value": "${event.data.selectedItems.label}"
                          }
                        },
                        {
                          "actionType": "setValue",
                          "componentId": "label",
                          "args": {
                            "value": "${event.data.selectedItems.label}"
                          }
                        },
                        {
                          "actionType": "想要在这里改变组件的items值",
                        
                        }
                      ]
                    }
                  },
                }),

hugo8680 avatar Aug 15 '25 09:08 hugo8680

👍 Thanks for this! 🏷 I have applied any labels matching special text in your issue.

Please review the labels and make any necessary changes.

github-actions[bot] avatar Aug 15 '25 09:08 github-actions[bot]

Image

hugo8680 avatar Aug 15 '25 09:08 hugo8680