- Changed component names from kebab-case to PascalCase in various files for consistency. - Updated `<router-view>` and `<transition>` to `<RouterView>` and `<Transition>` respectively in App.vue and base-layout.vue. - Refactored AppNaiveUIProvider.vue to use PascalCase for Naive UI providers. - Adjusted language and theme switch buttons to use PascalCase for icon components. - Updated button components in demo pages to use PascalCase for Naive UI buttons. - Modified ESLint rules in route message files to use perfectionist/sort-objects for better key sorting. - Enhanced Vite plugin files to export loadPlugin functions for better plugin management. - Improved plugin loading logic to handle errors and warnings more effectively.
59 lines
1.6 KiB
Vue
59 lines
1.6 KiB
Vue
<script setup lang="ts">
|
|
import type { GlobalThemeOverrides } from 'naive-ui';
|
|
import { darkTheme, dateZhCN, zhCN } from 'naive-ui';
|
|
import type { FunctionalComponent } from 'vue';
|
|
import { createTextVNode } from 'vue';
|
|
|
|
const appStore = useAppStore();
|
|
|
|
// https://www.naiveui.com/zh-CN/light/docs/customize-theme
|
|
const themeOverrides: GlobalThemeOverrides = {
|
|
common: {},
|
|
};
|
|
|
|
const ContextHolder: FunctionalComponent = () => {
|
|
window.$nLoadingBar = useLoadingBar();
|
|
window.$nModal = useModal();
|
|
window.$nDialog = useDialog();
|
|
window.$nMessage = useMessage();
|
|
window.$nNotification = useNotification();
|
|
return createTextVNode();
|
|
};
|
|
</script>
|
|
|
|
<script lang="ts">
|
|
declare global {
|
|
export interface Window {
|
|
$nLoadingBar?: import('naive-ui').LoadingBarProviderInst;
|
|
$nModal?: import('naive-ui').ModalProviderInst;
|
|
$nDialog?: import('naive-ui').DialogProviderInst;
|
|
$nMessage?: import('naive-ui').MessageProviderInst;
|
|
$nNotification?: import('naive-ui').NotificationProviderInst;
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<NConfigProvider
|
|
:locale="zhCN"
|
|
:date-locale="dateZhCN"
|
|
:theme-overrides
|
|
preflight-style-disabled
|
|
:theme="appStore.isDark ? darkTheme : null"
|
|
abstract
|
|
>
|
|
<NLoadingBarProvider>
|
|
<NMessageProvider>
|
|
<NNotificationProvider>
|
|
<NModalProvider>
|
|
<NDialogProvider>
|
|
<slot></slot>
|
|
<ContextHolder />
|
|
</NDialogProvider>
|
|
</NModalProvider>
|
|
</NNotificationProvider>
|
|
</NMessageProvider>
|
|
</NLoadingBarProvider>
|
|
</NConfigProvider>
|
|
</template>
|