Добавлен сервис уведомлений

This commit is contained in:
brusnitsyn
2025-12-19 09:19:41 +09:00
parent b86cdaec90
commit 9057d3e8ad
3 changed files with 65 additions and 6 deletions

View File

@@ -0,0 +1,22 @@
import {createDiscreteApi, darkTheme, lightTheme} from "naive-ui";
export function setupNaiveDiscreteApi(app) {
const {message, notification, dialog, loadingBar} = createDiscreteApi(
['message', 'dialog', 'notification', 'loadingBar'],
{
configProviderProps: {
theme: window.matchMedia('(prefers-color-scheme: dark)').matches ? darkTheme : lightTheme
}
}
)
window.$notification = notification
window.$message = message
window.$dialog = dialog
window.$loadingBar = loadingBar
app.config.globalProperties.$notification = notification
app.config.globalProperties.$message = message
app.config.globalProperties.$dialog = dialog
app.config.globalProperties.$loadingBar = loadingBar
}