vue2项目请移步@94ai/common-ui
LLMs.md

提示信息 ​

用于显示成功、警告、信息和错误提示,保留原有外观、HTML 标题/描述和三个插槽,支持 Chalk/OEM 组件主题。

主题/图标/关闭/居中 ​

正在加载示例…
主题/图标/关闭/居中

带有辅助性文字介绍 ​

正在加载示例…
带有辅助性文字介绍

插槽定制化 ​

正在加载示例…
插槽定制化

交互体验 ​

close: 0; submit: 0

按需引入 ​

ts
import NfAlert from '@94ai-plus/nf-alert'
import '@94ai-plus/nf-theme-chalk/nf-alert.css'

app.use(NfAlert)

类型 ​

ts
import type { AlertProps, AlertType, AlertEffect, AlertInstance } from '@94ai-plus/nf-alert'
// AlertType: 'success' | 'warning' | 'info' | 'error'
// AlertEffect: 'light' | 'dark'
// AlertInstance: { close(): void }

Attribute ​

参数说明类型可选值默认值
title标题,支持可信 HTML;也可通过 title 插槽传入。string—''
description辅助性文字。也可通过默认 slot 传入,默认插槽优先。string—''
type主题stringsuccess/warning/info/error'info'
closable是否可关闭boolean—true
close-text关闭按钮自定义文本string—''
showIcon是否显示图标boolean—true
center文字是否居中boolean—false
effect选择提供的主题stringlight/dark'light'

Event ​

事件名称说明回调参数
close关闭alert时触发的事件—

Slot ​

名称说明插槽参数
default描述—
title标题的内容—
close关闭的内容{ close: () => void }

迁移说明 ​

保留 8 个属性、无参数 close 事件及三个插槽。修复默认插槽与 description 同时传入时描述消失的问题,改为插槽优先;修复隐藏后重复关闭触发事件的问题。关闭后更新属性不会自动重新打开,请通过 key 重新挂载。

关闭按钮改为原生 button,支持键盘操作、八种语言的无障碍标签,且不会提交表单。图标改为内置 SVG,不依赖 Element UI 字体。close 插槽新增 close 回调,实例新增 close() 方法。effect 控制提示框外观,与文档/演练场的白黑主题相互独立。