/** * 组件树之外的提示能力(`useMessage` 只能在组件里用)。 * * http 拦截器、路由守卫这些地方都要弹提示,用 `createDiscreteApi` 建一套离屏实例, * 全应用共用一份 —— 每次调用新建实例会导致"弹出一堆重复提示"且不消失。 */ import { createDiscreteApi } from 'naive-ui' const { message, dialog, notification, loadingBar } = createDiscreteApi( ['message', 'dialog', 'notification', 'loadingBar'], { messageProviderProps: { max: 3, duration: 3000 }, notificationProviderProps: { max: 3 } } ) export { dialog, loadingBar, message, notification }