feat(projects): 添加NaiveProvider组件

This commit is contained in:
Soybean 2022-01-05 19:06:23 +08:00
parent 5bfb8199b4
commit c804b21ceb
6 changed files with 54 additions and 4 deletions

View File

@ -1,11 +1,20 @@
<template>
<n-config-provider :theme="theme.naiveTheme" :theme-overrides="theme.naiveThemeOverrides" class="h-full">
<slot></slot>
<n-config-provider
:theme="theme.naiveTheme"
:theme-overrides="theme.naiveThemeOverrides"
:locale="zhCN"
:date-locale="dateZhCN"
class="h-full"
>
<naive-provider>
<slot></slot>
</naive-provider>
</n-config-provider>
</template>
<script setup lang="ts">
import { NConfigProvider } from 'naive-ui';
import { NConfigProvider, zhCN, dateZhCN } from 'naive-ui';
import { NaiveProvider } from '@/components';
import { useThemeStore } from '@/store';
const theme = useThemeStore();

View File

@ -0,0 +1,18 @@
<template>
<div></div>
</template>
<script lang="ts" setup>
import { useLoadingBar, useDialog, useMessage, useNotification } from 'naive-ui';
// naivewindow, 便
function registerNaiveTools() {
window.$loadingBar = useLoadingBar();
window.$dialog = useDialog();
window.$message = useMessage();
window.$notification = useNotification();
}
registerNaiveTools();
</script>
<style scoped></style>

View File

@ -0,0 +1,3 @@
import NaiveProviderContent from './NaiveProviderContent.vue';
export { NaiveProviderContent };

View File

@ -0,0 +1,18 @@
<template>
<n-loading-bar-provider>
<n-dialog-provider>
<n-notification-provider>
<n-message-provider>
<slot></slot>
<naive-provider-content />
</n-message-provider>
</n-notification-provider>
</n-dialog-provider>
</n-loading-bar-provider>
</template>
<script setup lang="ts">
import { NLoadingBarProvider, NDialogProvider, NNotificationProvider, NMessageProvider } from 'naive-ui';
import { NaiveProviderContent } from './components';
</script>
<style scoped></style>

View File

@ -1,4 +1,5 @@
import NaiveProvider from './NaiveProvider/index.vue';
import SystemLogo from './SystemLogo/index.vue';
import DarkModeSwitch from './DarkModeSwitch/index.vue';
export { SystemLogo, DarkModeSwitch };
export { NaiveProvider, SystemLogo, DarkModeSwitch };

View File

@ -1,3 +1,4 @@
export * from './common';
export * from './common';
export * from './custom';
export * from './business';