123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- import { createApp, watchEffect } from 'vue';
- import { registerAccessDirective } from '@vben/access';
- import { initTippy, registerLoadingDirective } from '@vben/common-ui';
- import { MotionPlugin } from '@vben/plugins/motion';
- import { preferences } from '@vben/preferences';
- import { initStores } from '@vben/stores';
- import '@vben/styles';
- import '@vben/styles/antd';
- import { VueQueryPlugin } from '@tanstack/vue-query';
- import { useTitle } from '@vueuse/core';
- import { $t, setupI18n } from '#/locales';
- import { router } from '#/router';
- import { initComponentAdapter } from './adapter/component';
- import App from './app.vue';
- async function bootstrap(namespace: string) {
-
- await initComponentAdapter();
-
-
-
-
-
-
-
-
- const app = createApp(App);
-
- registerLoadingDirective(app, {
- loading: 'loading',
- spinning: 'spinning',
- });
-
- await setupI18n(app);
-
- await initStores(app, { namespace });
-
- registerAccessDirective(app);
-
- initTippy(app);
-
- app.use(router);
-
- app.use(VueQueryPlugin);
-
- app.use(MotionPlugin);
-
- watchEffect(() => {
- if (preferences.app.dynamicTitle) {
- const routeTitle = router.currentRoute.value.meta?.title;
- const pageTitle =
- (routeTitle ? `${$t(routeTitle)} - ` : '') + preferences.app.name;
- useTitle(pageTitle);
- }
- });
- app.mount('#app');
- }
- export { bootstrap };
|