amis icon indicating copy to clipboard operation
amis copied to clipboard

当service嵌套service时,里面的service无法触发刷新

Open Jarod-Xie opened this issue 2 years ago • 4 comments

描述问题:

当service嵌套service时,都设置了不同的name,里面的service无法被触发刷新,只能触发最顶层service的刷新。

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

  1. 你是如何使用 amis 的? 在官方编辑器中使用

  2. amis 版本是什么?请先在最新 beta 版本测试问题是否存在 https://aisuda.github.io/amis-editor-demo/ 在官方编辑器页面可复现问题。

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

{
  "type": "page",
  "title": "测试service",
  "body": [
    {
      "type": "tpl",
      "tpl": "<p>页面最外层</p>",
      "inline": false,
      "id": "u:4947e7151ca3"
    },
    {
      "type": "button-group",
      "buttons": [
        {
          "type": "button",
          "label": "刷新serviceA",
          "onEvent": {
            "click": {
              "actions": [
              ]
            }
          },
          "id": "u:1f50ee581357",
          "actionType": "reload",
          "target": "serviceB,serviceA",
          "reload": "serviceA"
        },
        {
          "type": "button",
          "label": "刷新serviceB",
          "onEvent": {
            "click": {
              "actions": [
              ]
            }
          },
          "id": "u:4321495a77ca",
          "actionType": "reload",
          "target": "serviceB,serviceA"
        }
      ],
      "id": "u:1eb49b732d58"
    },
    {
      "type": "service",
      "body": [
        {
          "type": "tpl",
          "tpl": "<p>serviceB</p>",
          "inline": false,
          "id": "u:7f52c4df5758"
        },
        {
          "type": "service",
          "body": [
            {
              "type": "tpl",
              "tpl": "<p>service A</p>",
              "inline": false,
              "id": "u:ca21e5d9001b"
            }
          ],
          "id": "u:e7a5d54a6796",
          "messages": {
          },
          "name": "serviceB",
          "api": "https://aisuda.bce.baidu.com/amis/api/sample"
        }
      ],
      "id": "u:e238e2d038e2",
      "messages": {
      },
      "name": "serviceB",
      "api": "https://aisuda.bce.baidu.com/amis/api/mock2/sample"
    }
  ],
  "id": "u:2777eb1f0721"
}
  1. 操作步骤 点击两个刷新按钮,可以看到始终只能触发serviceB的刷新,无法触发serviceA的刷新。 如果把两个service调换位置,再试。可以总结出只能触发顶层service的刷新,里面的刷新无法触发。

希望能尽快修改,这个问题是我们内部推行amis最大的一个问题了。

Jarod-Xie avatar Sep 03 '22 01:09 Jarod-Xie

为何写这么麻烦?

qsy1403813547 avatar Sep 14 '22 03:09 qsy1403813547

为何写这么麻烦?

是在一个复杂页面中遇到了这样的场景。一个接口请求页面的全局数据,一个接口请求一个表格数据,在表格中操作完后要刷新表格数据,因为上面的原因,刷新不了。

Jarod-Xie avatar Sep 14 '22 07:09 Jarod-Xie

如果不是同一层次的写成数组

qsy1403813547 avatar Sep 14 '22 07:09 qsy1403813547

最外层用from

qsy1403813547 avatar Sep 14 '22 07:09 qsy1403813547