Tips 提示气泡
用于页面顶部或特定区块内部展示轻量通告信息、警告或状态提醒的提示条组件,支持 4 种状态主题与手动关闭。
代码示例
1. 基础用法 (Basic Usage)
vue
<template>
<mu-tips type="info" text="提示:您的账号资料完整度已达到 90%" />
<mu-tips type="success" text="成功:数据已成功同步至本地缓存" />
<mu-tips type="warning" text="警告:当前处于试用阶段" />
<mu-tips type="error" text="错误:网络请求连接超时" />
</template>2. 可手动关闭 (Closable Tips)
设置 closable 属性显示关闭图标按钮。
vue
<template>
<mu-tips type="info" closable text="请勿将验证码泄露给他人" @close="onClose" />
</template>
<script setup>
function onClose() {
console.log('提示条已关闭')
}
</script>API 属性说明 (Props)
| 参数名 | 说明 | 类型 | 可选值 | 默认值 |
|---|---|---|---|---|
| show / v-model:show | 控制提示条显示与隐藏 | Boolean | true | false | true |
| text | 提示消息文案 | String | - | '' |
| type | 提示消息主题类型 | String | info | success | warning | error | 'info' |
| closable | 是否显示右侧关闭按钮 | Boolean | true | false | false |
事件说明 (Events)
| 事件名 | 说明 | 回调参数 |
|---|---|---|
| close | 点击右侧关闭按钮时触发 | - |
| update:show | 支持 v-model:show 双向绑定更新 | (show: boolean) |
插槽说明 (Slots)
| 插槽名 | 说明 |
|---|---|
| default | 自定义提示消息文本内容插槽 |
| icon | 自定义左侧前置图标插槽 |