Skip to content

open dialog from avatar - action component to support body element #3081

@abasse

Description

@abasse

I would like to open a dialog when a user clicks on the avatar component. At the moment the avatar component does not support any actions.

Is there an other was to wrap the avatar component into another component to open a dialog?

This would be nice:

{
  "type": "page",
  "body": {
    "type": "avatar",
    "src": "https://suda.cdn.bcebos.com/images/amis/ai-fake-face.jpg",
    "hotKey": "command+i,ctrl+i",
    "actionType": "dialog",
    "dialog": {
      "title": "弹框",
      "body": "这是个简单的弹框。"
    }
  }
}

or to be able to add body to an action (preferred solution):

{
  "type": "page",
  "body": {
    "type": "action",
    "body": [
        {
      "type": "avatar",
     "src": "https://suda.cdn.bcebos.com/images/amis/ai-fake-face.jpg"
      }
     ],
    "actionType": "dialog",
    "dialog": {
      "title": "弹框",
      "body": "这是个简单的弹框。"
    }
  }
}

The second approach would also support a lot of other usage scenarios, where some would like to add actions to existing components.

Thanks for your consideration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions