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

action的防抖不生效,设置leading为true,trailing为false,没有起到防抖作用 #10181

Open
nabaonan opened this issue May 8, 2024 · 0 comments
Assignees

Comments

@nabaonan
Copy link
Contributor

nabaonan commented May 8, 2024

描述问题:

设置leading为true,trailing为false,没有起到防抖作用

截图或视频:

一秒之内点击多次都会触发
image

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

  1. 你是如何使用 amis 的?
    官网的编辑器

  2. amis 版本是什么?请先在最新 beta 版本测试问题是否存在
    官方编辑器页面测试

  3. 粘贴有问题的完整 amis schema 代码:

{
  "type": "page",
  "title": "Hello world",
  "body": [
    {
      "type": "button",
      "id": "u:bef6ebd73a3f",
      "label": "按钮",
      "onEvent": {
        "click": {
          "actions": [
            {
              "args": {},
              "actionType": "custom",
              "script": "/* 自定义JS使用说明:\n  * 1.动作执行函数doAction,可以执行所有类型的动作\n  * 2.通过上下文对象context可以获取当前组件实例,例如context.props可以获取该组件相关属性\n  * 3.事件对象event,在doAction之后执行event.stopPropagation();可以阻止后续动作执行\n*/\nconst myMsg = '我是自定义JS';\ndoAction({\n  actionType: 'toast',\n  args: {\n    msg: myMsg\n  }\n});\n"
            }
          ],
          "debounce": {
            "leading": true,
            "wait": 1000,
            "trailing": false
          }
        }
      }
    }
  ],
  "id": "u:c2a087973790"
}
  1. 操作步骤
    连续点击按钮,不会有防抖间隔,会立即触发
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

2 participants