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

Wizard 向导组件 单步Step 自定义actions 执行 onEvent 事件异常 #11270

Open
jinmingpang opened this issue Nov 27, 2024 · 0 comments

Comments

@jinmingpang
Copy link
Contributor

jinmingpang commented Nov 27, 2024

描述问题:

Wizard 向导组件,单步 Step 自定义 actions 时, 第二步中的“上一步”按钮,意外触发了 第一步中 的 “取消” 按钮中的事件。

截图或视频:

image

“取消” toast, 是第一步 “取消” 按钮绑定的 “onEvent”, 但是被第2步中的,“上一步”按钮,意外触发了一次。

如何复现(请务必完整填写下面内容):

  • 复制提供的 schema
  • 点击 第1步中的“下一步”按钮(进入到第二步)
  • 点击 第2步中的“上一步”按钮(此时会意外触发,第1步中的“取消”按钮的事件一次,第2次点击正常。 期望:不意外触发多余事件
  1. 你是如何使用 amis 的?
    npm

  2. amis 版本是什么?请先在最新 beta 版本测试问题是否存在

存在

  1. 粘贴有问题的完整 amis schema 代码:
{
  "type": "page",
  "body": {
    "type": "wizard",
    "id": "wizard",
    "steps": [
      {
        "title": "第一步",
        "body": [
          {
            "name": "website",
            "label": "文本1",
            "type": "input-text"
          },
         
        ],
        "actions": [
          {
            "label": "取消",
            "type": "button",
            "onEvent": {
              "click": {
                "actions": [
                  {
                    "actionType": "toast",
                    "args": {
                      "msg": "取消"
                    }
                  }
                ]
              }
            }
          },
          {
            "label": "下一步",
            "type": "button",
            "onEvent": {
              "click": {
                "actions": [
                  {
                    "actionType": "next",
                    "componentId": "wizard"
                  }
                ]
              }
            }
          }
        ]
      },
      {
        "title": "Step 2",
        "body": [
          {
            "name": "email2",
            "label": "文本2",
            "type": "input-text"
          }
        ],
        "actions": [
          {
            "label": "上一步",
            "type": "button",
            "onEvent": {
              "click": {
                "actions": [
                  {
                    "actionType": "prev",
                    "componentId": "wizard"
                  }
                ]
              }
            }
          },
          {
            "label": "下一步",
            "type": "button",
            "onEvent": {
              "click": {
                "actions": [
                  {
                    "actionType": "next",
                    "componentId": "wizard"
                  }
                ]
              }
            }
          }
        ]
      },
     
    ]
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant