Thanks to visit codestin.com
Credit goes to github.com

Skip to content

6.8.0 广播事件无效 #10939

@xiukun

Description

@xiukun

描述问题:

https://aisuda.bce.baidu.com/amis/zh-CN/docs/concepts/event-action#%E8%A7%A6%E5%8F%91%E5%B9%BF%E6%92%AD
广播事件示例在6.8.0中无效,在最新设计器中和在vue中引入6.8.0 sdk无法正常toast提示及赋值。
使用6.7.0是正常的。

截图或视频:

可以的话,尽可能提供截图或视频来补充描述你的问题...

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

  1. 你是如何使用 amis 的?
    sdknpm其他...
    sdk
    npm

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

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

{
  "type": "page",
  "body": [
    {
      "name": "role",
      "type": "select",
      "label": "广播一下",
      "mode": "row",
      "options": [
        {
          "label": "海贼王的男人",
          "value": "路飞"
        },
        {
          "label": "海上华佗",
          "value": "乔巴"
        },
        {
          "label": "海上食神",
          "value": "山治"
        }
      ],
      "onEvent": {
        "change": {
          "actions": [
            {
              "actionType": "broadcast",
              "args": {
                "eventName": "broadcast_1"
              },
              "data": {
                "myrole": "${role}",
                "age": 18
              }
            }
          ]
        }
      }
    },
    {
      "type": "form",
      "id": "form_001",
      "title": "表单1(优先级低)",
      "name": "sub-form1",
      "body": [
        {
          "type": "input-text",
          "label": "昵称",
          "name": "myname",
          "disabled": false,
          "mode": "horizontal"
        }
      ],
      "onEvent": {
        "broadcast_1": {
          "actions": [
            {
              "actionType": "reload",
              "componentId": "form_001",
              "data": {
                "myname": "${myrole}"
              }
            },
            {
              "actionType": "toast",
              "args": {
                "msgType": "info",
                "msg": "表单1刷新完成"
              }
            }
          ]
        }
      }
    },
    {
      "type": "form",
      "name": "form2",
      "id": "form_002",
      "title": "表单2(优先级中)",
      "body": [
        {
          "type": "input-text",
          "label": "角色",
          "name": "myrole",
          "disabled": false,
          "mode": "horizontal"
        },
        {
          "type": "input-text",
          "label": "年龄",
          "name": "age",
          "disabled": false,
          "mode": "horizontal"
        }
      ],
      "onEvent": {
        "broadcast_1": {
          "weight": 2,
          "actions": [
            {
              "actionType": "reload",
              "componentId": "form_002",
              "data": {
                "myrole": "${myrole}",
                "age": "${age}"
              }
            },
            {
              "actionType": "toast",
              "args": {
                "msgType": "info",
                "msg": "表单2刷新完成"
              }
            }
          ]
        }
      }
    },
    {
      "type": "form",
      "name": "form3",
      "id": "form_003",
      "title": "表单3(优先级高)",
      "body": [
        {
          "type": "input-text",
          "id": "form_003_text_01",
          "label": "职业",
          "name": "job",
          "disabled": false,
          "mode": "horizontal"
        }
      ],
      "api": "https://api/form/form3",
      "onEvent": {
        "broadcast_1": {
          "weight": 3,
          "actions": [
            {
              "actionType": "reload",
              "componentId": "form_003",
              "data": {
                "job": "${myrole}"
              }
            },
            {
              "actionType": "toast",
              "args": {
                "msgType": "info",
                "msg": "表单3刷新完成"
              }
            }
          ]
        }
      }
    }
  ]
}

  1. 操作步骤
    请简单描述一下复现的操作步骤...

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions