amis icon indicating copy to clipboard operation
amis copied to clipboard

多级弹窗场景可以打开子弹窗的同时关闭父级弹窗吗?

Open wubin1989 opened this issue 3 months ago • 7 comments

多级弹窗场景可以打开子弹窗的同时关闭父级弹窗吗?

wubin1989 avatar Mar 15 '24 11:03 wubin1989

可以

xiahao90 avatar Mar 18 '24 01:03 xiahao90

@xiahao90 请问如何配置呢?我尝试过多次,如果给父级弹窗设置了提交后关闭,且提交后打开子弹窗,实际效果总是子弹窗打开后会马上跟父级弹窗一起闪退。谢谢指导!

wubin1989 avatar Mar 18 '24 02:03 wubin1989

去看看https://aisuda.bce.baidu.com/amis/zh-CN/docs/concepts/event-action 事件动作,可以的关闭多个

xiahao90 avatar Mar 18 '24 03:03 xiahao90

@xiahao90 我的需求不是关闭多个,而是打开子弹窗之前关闭父弹窗,一关一开的效果。现在默认是多级弹窗都只能同时打开。

wubin1989 avatar Mar 19 '24 10:03 wubin1989

你在关闭弹框动作加个componetID,填上弹框id就可以了

ziBLan avatar Apr 18 '24 01:04 ziBLan

你在关闭弹框动作加个componetID,填上弹框id就可以了

试过了。还是不行

wubin1989 avatar May 24 '24 04:05 wubin1989

@ziBLan 这是可以复现问题的schema源码:

{
  "type": "page",
  "title": "多级弹窗bug复现",
  "body": [
    {
      "type": "button",
      "label": "点我",
      "actionType": "dialog",
      "level": "primary",
      "dialog": {
        "type": "dialog",
        "title": "一级弹窗",
        "body": [
          {
            "type": "button",
            "label": "按钮",
            "onEvent": {
              "click": {
                "actions": [
                  {
                    "ignoreError": false,
                    "actionType": "closeDialog",
                    "componentId": "u:e87f1cb48b19"
                  },
                  {
                    "ignoreError": false,
                    "actionType": "dialog",
                    "dialog": {
                      "type": "dialog",
                      "title": "二级弹窗",
                      "body": [
                        {
                          "type": "tpl",
                          "tpl": "弹窗内容",
                          "id": "u:6a2533606314"
                        }
                      ],
                      "id": "u:bee964d7f84d",
                      "actions": [
                        {
                          "type": "button",
                          "actionType": "cancel",
                          "label": "取消",
                          "id": "u:c842c40f0212"
                        },
                        {
                          "type": "button",
                          "actionType": "confirm",
                          "label": "确定",
                          "primary": true,
                          "id": "u:bfcb369de48d"
                        }
                      ],
                      "actionType": "dialog",
                      "showCloseButton": true,
                      "closeOnOutside": false,
                      "closeOnEsc": false,
                      "showErrorMsg": true,
                      "showLoading": true,
                      "draggable": false
                    }
                  }
                ]
              }
            },
            "id": "u:62b33e843d58"
          }
        ],
        "size": "lg",
        "actions": [
          {
            "type": "button",
            "actionType": "cancel",
            "label": "取消",
            "id": "u:5d01cdee8412"
          },
          {
            "type": "button",
            "actionType": "confirm",
            "label": "确定",
            "primary": true,
            "id": "u:15e9b062157d",
            "onEvent": {
              "click": {
                "weight": 0,
                "actions": []
              }
            }
          }
        ],
        "id": "u:e87f1cb48b19",
        "actionType": "dialog",
        "showCloseButton": true,
        "closeOnOutside": false,
        "closeOnEsc": false,
        "showErrorMsg": true,
        "showLoading": true,
        "draggable": false
      },
      "id": "u:db2f03aac008"
    }
  ],
  "asideResizor": true,
  "pullRefresh": {
    "disabled": true
  },
  "id": "u:6431be9d53ef",
  "definitions": {}
}

我把关闭本级弹窗和打开二级弹窗的两个action调换顺序也不行。

wubin1989 avatar May 24 '24 04:05 wubin1989