|
|
|
|
@ -1,17 +1,19 @@
|
|
|
|
|
import { createApp } from 'vue';
|
|
|
|
|
import { createApp, watchEffect } from 'vue';
|
|
|
|
|
|
|
|
|
|
import { registerAccessDirective } from '@vben/access';
|
|
|
|
|
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 { setupI18n } from '#/locales';
|
|
|
|
|
import { $t, setupI18n } from '#/locales';
|
|
|
|
|
import { router } from '#/router';
|
|
|
|
|
|
|
|
|
|
import { initComponentAdapter } from './adapter/component';
|
|
|
|
|
import App from './app.vue';
|
|
|
|
|
import { router } from './router';
|
|
|
|
|
|
|
|
|
|
async function bootstrap(namespace: string) {
|
|
|
|
|
// 初始化组件适配器
|
|
|
|
|
@ -34,6 +36,16 @@ async function bootstrap(namespace: string) {
|
|
|
|
|
// 配置@tanstack/vue-query
|
|
|
|
|
app.use(VueQueryPlugin);
|
|
|
|
|
|
|
|
|
|
// 动态更新标题
|
|
|
|
|
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');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|