import{c as t,o as d,D as e}from"./index.d870aa4d.js";const n={class:"markdown-body"},a=e('

Notify 消息通知

介绍

在页面顶部展示消息提示

安装

import { createApp } from 'vue';\nimport { Notify } from '@nutui/nutui';\n\nconst app = createApp();\napp.use(Notify);\n

基本用法

export default {\n  mounted() {\n      Notify.text('通知内容', {\n        onClosed() {\n          console.log('close');\n        },\n        onClick: () => {\n          console.log('click');\n        }\n      });\n  }\n}\n

通知类型

主要通知

    mounted(){\n      Notify.primary('通知内容');\n    }\n

成功通知

    mounted(){\n      Notify.success('通知内容');\n    }\n

危险通知

    mounted(){\n      Notify.danger('通知内容');\n    }\n

警告通知

    mounted(){\n      Notify.warn('通知内容');\n    }\n

自定义

自定义样式

    mounted(){\n      Notify.text(val, {\n        color: '#ad0000',\n        background: '#ffe1e1'\n      });\n    }\n

自定义时长

    mounted(){\n      Notify.text(val, {\n        duration: 10000\n      });\n    }\n

API

Props

字段说明类型默认值
type提示的信息String
message展示文案,支持通过\\n换行Booleanfalse
duration展示时长(ms),值为 0 时,notify 不会消失String
color字体颜色String
background背景颜色String
class-name自定义类名String/Number1

Events

事件名说明回调参数
on-click点击事件回调
on-close关闭事件回调
',26),o={expose:[],setup:e=>(e,o)=>(d(),t("div",n,[a]))};export default o;