V1.0.0
Skip to content

WAlert 提示组件 ​

提示组件,基于 WinDesignNext Alert 封装,用于页面中展示警告、成功、错误等反馈信息。

基础用法 ​

API ​

属性类型默认值说明
componentstringWAlert组件类型(必填)
titlestring | DataBindingValue—提示标题
descriptionstring | DataBindingValue—提示描述
typestringprimary类型:primary / success / warning / info / error / danger
effectstringlight主题:light / dark
closablebooleantrue是否可关闭
closeTextstring | DataBindingValue—关闭按钮文字
showIconbooleanfalse是否显示图标
centerbooleanfalse文字是否居中
showAfternumber0延迟显示(ms)
hideAfternumber200关闭动画时长(ms)
autoClosenumber0自动关闭延时(ms),0 不自动关闭
actionobject—关闭事件配置
childstring—自定义内容子组件 ID

事件 ​

事件type说明
关闭提示close用户点击关闭按钮时触发
json
{
  "action": {
    "event": {
      "name": "onAlertClose",
      "type": "close"
    }
  }
}

path 支持说明 ​

属性path 支持说明
title✅动态标题
description✅动态描述正文
type✅动态提示类型
closeText✅动态关闭按钮文字

动态描述 ​

json
{
  "component": "WAlert",
  "type": { "path": "/alertType" },
  "title": "系统通知",
  "description": { "path": "/alertMessage" }
}

使用场景 ​

场景推荐配置
操作成功提示type: "success" + showIcon: true
警告/风险提示type: "warning" + path 绑定描述
可关闭通知closable: true + action close 事件
自动消失autoClose: 3000

注意事项 ​

  • description 与 child 二选一:简单文本用 description,复杂内容用 child 引用子组件
  • icon、title 插槽无法在 A2UI JSON 中配置,请使用属性或 child