feat(projects): add app loading
This commit is contained in:
parent
2372dc9bb7
commit
c65451b34c
@ -4,6 +4,7 @@ import { NConfigProvider, darkTheme } from 'naive-ui';
|
|||||||
import { useAppStore } from './store/modules/app';
|
import { useAppStore } from './store/modules/app';
|
||||||
import { useThemeStore } from './store/modules/theme';
|
import { useThemeStore } from './store/modules/theme';
|
||||||
import { naiveDateLocales, naiveLocales } from './locales/naive';
|
import { naiveDateLocales, naiveLocales } from './locales/naive';
|
||||||
|
import AppLoading from './components/common/app-loading.vue';
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'App'
|
name: 'App'
|
||||||
@ -24,6 +25,7 @@ const naiveDateLocale = computed(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<Suspense>
|
||||||
<NConfigProvider
|
<NConfigProvider
|
||||||
:theme="naiveDarkTheme"
|
:theme="naiveDarkTheme"
|
||||||
:theme-overrides="themeStore.naiveTheme"
|
:theme-overrides="themeStore.naiveTheme"
|
||||||
@ -35,6 +37,10 @@ const naiveDateLocale = computed(() => {
|
|||||||
<RouterView class="bg-layout" />
|
<RouterView class="bg-layout" />
|
||||||
</AppProvider>
|
</AppProvider>
|
||||||
</NConfigProvider>
|
</NConfigProvider>
|
||||||
|
<template #fallback>
|
||||||
|
<AppLoading />
|
||||||
|
</template>
|
||||||
|
</Suspense>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
@ -4,9 +4,14 @@ import { setupDayjs, setupIconifyOffline, setupNProgress } from './plugins';
|
|||||||
import { setupStore } from './store';
|
import { setupStore } from './store';
|
||||||
import { setupRouter } from './router';
|
import { setupRouter } from './router';
|
||||||
import { setupI18n } from './locales';
|
import { setupI18n } from './locales';
|
||||||
|
import AppLoading from './components/common/app-loading.vue';
|
||||||
import App from './App.vue';
|
import App from './App.vue';
|
||||||
|
|
||||||
async function setupApp() {
|
async function setupApp() {
|
||||||
|
const appLoading = createApp(AppLoading);
|
||||||
|
|
||||||
|
appLoading.mount('#appLoading');
|
||||||
|
|
||||||
setupNProgress();
|
setupNProgress();
|
||||||
|
|
||||||
setupIconifyOffline();
|
setupIconifyOffline();
|
||||||
@ -22,6 +27,8 @@ async function setupApp() {
|
|||||||
setupI18n(app);
|
setupI18n(app);
|
||||||
|
|
||||||
app.mount('#app');
|
app.mount('#app');
|
||||||
|
|
||||||
|
appLoading.unmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
setupApp();
|
setupApp();
|
||||||
|
1
src/typings/components.d.ts
vendored
1
src/typings/components.d.ts
vendored
@ -36,7 +36,6 @@ declare module 'vue' {
|
|||||||
NFormItem: typeof import('naive-ui')['NFormItem']
|
NFormItem: typeof import('naive-ui')['NFormItem']
|
||||||
NInput: typeof import('naive-ui')['NInput']
|
NInput: typeof import('naive-ui')['NInput']
|
||||||
NInputNumber: typeof import('naive-ui')['NInputNumber']
|
NInputNumber: typeof import('naive-ui')['NInputNumber']
|
||||||
NInputPassword: typeof import('naive-ui')['NInputPassword']
|
|
||||||
NLoadingBarProvider: typeof import('naive-ui')['NLoadingBarProvider']
|
NLoadingBarProvider: typeof import('naive-ui')['NLoadingBarProvider']
|
||||||
NMenu: typeof import('naive-ui')['NMenu']
|
NMenu: typeof import('naive-ui')['NMenu']
|
||||||
NMessageProvider: typeof import('naive-ui')['NMessageProvider']
|
NMessageProvider: typeof import('naive-ui')['NMessageProvider']
|
||||||
|
Loading…
Reference in New Issue
Block a user