mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-11-09 13:53:38 +08:00
feat: 抽离默认配置选项
This commit is contained in:
40
src/main.ts
40
src/main.ts
@@ -6,6 +6,7 @@ import { createApp, Directive } from "vue";
|
||||
import { usI18n } from "../src/plugins/i18n";
|
||||
import { useTable } from "../src/plugins/vxe-table";
|
||||
import { useElementPlus } from "../src/plugins/element-plus";
|
||||
import { injectResponsiveStorage } from "/@/utils/storage/responsive";
|
||||
|
||||
import "animate.css";
|
||||
// 导入公共样式
|
||||
@@ -17,49 +18,14 @@ import "v-contextmenu/dist/themes/default.css";
|
||||
|
||||
const app = createApp(App);
|
||||
|
||||
// 响应式storage
|
||||
import Storage from "responsive-storage";
|
||||
// @ts-ignore
|
||||
app.use(Storage, {
|
||||
// 默认显示首页tag
|
||||
routesInStorage: {
|
||||
type: Array,
|
||||
default: Storage.getData(undefined, "routesInStorage") ?? [
|
||||
{
|
||||
path: "/welcome",
|
||||
parentPath: "/",
|
||||
meta: {
|
||||
title: "message.hshome",
|
||||
icon: "el-icon-s-home",
|
||||
showLink: true,
|
||||
savedPosition: false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
// 国际化 默认中文zh
|
||||
locale: {
|
||||
type: Object,
|
||||
default: Storage.getData(undefined, "locale") ?? {
|
||||
locale: "zh"
|
||||
}
|
||||
},
|
||||
// layout模式以及主题
|
||||
layout: {
|
||||
type: Object,
|
||||
default: Storage.getData(undefined, "layout") ?? {
|
||||
layout: "vertical-dark"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 自定义指令
|
||||
import * as directives from "/@/directives";
|
||||
Object.keys(directives).forEach(key => {
|
||||
app.directive(key, (directives as { [key: string]: Directive })[key]);
|
||||
});
|
||||
|
||||
getServerConfig(app).then(async () => {
|
||||
getServerConfig(app).then(async config => {
|
||||
injectResponsiveStorage(app, config);
|
||||
setupStore(app);
|
||||
app.use(router).use(useElementPlus).use(useTable).use(usI18n);
|
||||
await router.isReady();
|
||||
|
||||
Reference in New Issue
Block a user