Skip to content

Alert 警告提示

用于页面顶部或局部的静态警告、信息提醒与异常状态通知控件,支持 info / success / warning / error 四大主题语义与 glass (毛玻璃) / filled (实色填充) / plain (简洁) 变体。


代码示例

1. 基础提示 (Basic Usage)

vue
<template>
  <mu-alert title="系统通知" description="项目已成功编译并发布至生产环境。" type="success" />
</template>

2. 变体与关闭按钮 (Variants & Closable)

vue
<template>
  <mu-alert
    title="请注意"
    description="账户余额不足,请及时充值。"
    type="warning"
    variant="filled"
    closable
    @close="onClose"
  />
</template>

<script setup>
function onClose() {
  console.log('警告提示已被用户手动关闭')
}
</script>

API 属性说明 (Props)

参数名说明类型可选值默认值
type警告类型与语义主题Stringinfo | success | warning | error'info'
variant外观形态变体Stringglass | filled | plain'glass'
title警告大标题String-''
description详细描述文案String-''
icon自定义前置矢量图标名称String-''
showIcon是否显示前置图标Booleantrue | falsetrue
closable是否显示右侧关闭图标按钮Booleantrue | falsefalse
margin外边距(CSS margin 语法)String-''
round是否开启圆角样式Booleantrue | falsefalse

事件说明 (Events)

事件名说明回调参数
close点击关闭图标关闭时触发-

插槽说明 (Slots)

插槽名说明
default自定义描述内容 Body 插槽
icon自定义前置图标插槽

基于 MIT 协议开源发行

H5 模拟器 (alert)☀️🔄