amis icon indicating copy to clipboard operation
amis copied to clipboard

请问drawer只能由Action触发吗

Open tongluyang opened this issue 7 years ago • 2 comments

我想实现这么一个场景,点击一个Tree的节点时,打开一个侧边框,侧边框根据选中节点的值,显示不同的内容

我本来是想利用联动,类似如下

{
    "type": "page", 
    "name": "page", 
    "title": "i'm title",
    "aside": {
        "title": "",
        "type": "form",
        "mode": "horizontal",
        "autoFocus": false,
        "controls": [
            {
                "type": "tree",
                "name": "tree",
                "value": 2,
                "hideRoot": true,
                "options": options
            },
            {
                "type": "service",
                "api": "https://houtai.baidu.com/api/mock2/form/initData?tpl=${tree}",
                "body": {
                    "type": "drawer",
                    "drawer": {
                        "title": "表单设置",
                        "body": "123"
                    }
                }
            }
        ],
        "submitText": null,
        "actions": [],
    },
    "body": "im body"
}

联动的api请求可以发出,但是drawer不会打开,请问是我使用方式有问题,还是不支持这种情况?

tongluyang avatar Aug 15 '19 01:08 tongluyang

点 tree 现在没办法直接打开一个 drawer 来个按钮吧。比如:

{
    "type": "page", 
    "name": "page", 
    "title": "i'm title",
    "aside": {
        "title": "",
        "type": "form",
        "mode": "horizontal",
        "autoFocus": false,
        "controls": [
            {
                "type": "tree",
                "name": "tree",
                "value": 2,
                "hideRoot": true,
                "options": options
            },
            {
                "type": "button",
                "actionType": "drawer",
                "label": "查看详情",
                "drawer":  {
                       "title": "详情",
                       "body": {
                            "type": "service",
                             "api": "https://houtai.baidu.com/api/mock2/form/initData?tpl=${tree}" ,
                            "body": "<pre>${&|json}</pre>"
                       }
                 }
            }
        ],
        "submitText": null,
        "actions": [],
    },
    "body": "im body"
}

2betop avatar Aug 15 '19 01:08 2betop

好的,谢谢

另外 action-type笔误,应为actionType,其他有需要的朋友注意

tongluyang avatar Aug 15 '19 01:08 tongluyang