Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

线上环境addBuiltinComponentAction中的conten.icon为Dropdown,action 函数不触发 #2622

Closed
Super-Rz opened this issue Nov 8, 2023 · 3 comments
Assignees
Labels
insufficient information Further information is requested / 信息不足,请补充信息

Comments

@Super-Rz
Copy link
Contributor

Super-Rz commented Nov 8, 2023

在设计器辅助层增加一个Fusion Dropdown到的action,点击Dropdown中的子项时,action函数不触发,本地环境是可以的,请问是什么原因呢,有无其他方案?

@JackLian JackLian added the insufficient information Further information is requested / 信息不足,请补充信息 label Nov 9, 2023
@JackLian
Copy link
Collaborator

JackLian commented Nov 9, 2023

补充个demo吧

Copy link

github-actions bot commented Nov 9, 2023

你好 @Super-Rz,由于缺乏必要的信息(如 bug 重现步骤、引擎版本信息 等),无法定位问题,请按照 issue bug 模板 补全信息,也可以通过阅读 引擎的 issue 说明 了解什么类型的 issue 可以获得更好、更快的支持。

@Super-Rz
Copy link
Contributor Author

Super-Rz commented Nov 9, 2023

 material.addBuiltinComponentAction({
          name: 'settetSwitch',
          content: {
            icon:  (
              <Dropdown
              trigger={<Icon type="switch" size="small" />}
              onVisibleChange={() => store.set('setterValue', null)}
              triggerType={['hover']}
            >
              <div>
                {setterModel.map((item) => (
                  <div
                    className="component-select-item"
                    onClick={() => {
                      store.set('setterValue', item.value);
                    }}
                  >
                    {item.label}
                  </div>
                ))}
              </div>
            </Dropdown>
            ),
            title: 'Setter切换',
            action(node: Node) {
              // 本地环境可以触发,线上不行
              const setter = store.get('setterValue');
              if (setter) {
                node.setPropValue('setter.componentName', setter);
                node?.document?.selection.remove(node.id);
              }
            },
          },
          condition: (node: Node) => {
            return node.componentMeta?.componentName === 'Setters';
          },
          important: true,
        });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
insufficient information Further information is requested / 信息不足,请补充信息
Projects
None yet
Development

No branches or pull requests

3 participants