Skip to content
On this page

事件与行为

事件动作

概念 > 事件动作

内置行为

使用 action 行为按钮组件,触发 amis 内置的页面交互操作。

使用 actionType 来配置组件具体的行为。

完整的行为列表可以查看 action 组件。

json
{
  "type": "page",
  "body": {
    "label": "action示例:弹框",
    "type": "button",
    "actionType": "dialog",
    "dialog": {
      "title": "弹框",
      "body": "这是个简单的弹框。"
    }
  }
}

渲染效果

json
{
  "type": "page",
  "body": {
    "type": "action",
    "label": "action示例:发出一个请求",
    "actionType": "ajax",
    "api": "/amis/api/mock2/form/saveForm"
  }
}

渲染效果

事件监听

事件监听用于给复杂的UI交互场景提供了通用的解决方案

将 amis 当成 UI 库用 > 事件监听