提交 | 用户 | 时间
|
314507
|
1 |
// 初始化多语言 |
H |
2 |
import { setupI18n } from '@/plugins/vueI18n' |
|
3 |
|
|
4 |
// 引入unocss css |
|
5 |
import '@/plugins/unocss' |
|
6 |
|
|
7 |
// 引入状态管理 |
|
8 |
import { setupStore } from '@/store' |
|
9 |
|
|
10 |
// 全局组件 |
|
11 |
import { setupGlobCom } from '@/components' |
|
12 |
|
|
13 |
// 引入 element-plus |
|
14 |
import { setupElementPlus } from '@/plugins/elementPlus' |
|
15 |
|
|
16 |
// 引入全局样式 |
|
17 |
import '@/styles/index.scss' |
|
18 |
|
|
19 |
// 引入动画 |
|
20 |
import '@/plugins/animate.css' |
|
21 |
|
|
22 |
// 路由 |
|
23 |
import router, { setupRouter } from '@/router' |
|
24 |
|
|
25 |
import { createApp } from 'vue' |
|
26 |
|
|
27 |
import App from './App.vue' |
|
28 |
|
|
29 |
import './permission' |
|
30 |
|
|
31 |
const app = createApp(App) |
|
32 |
|
|
33 |
// 创建实例 |
|
34 |
const setupAll = async () => { |
|
35 |
await setupI18n(app) |
|
36 |
setupGlobCom(app) |
|
37 |
setupElementPlus(app) |
|
38 |
setupStore(app) |
|
39 |
setupRouter(app) |
|
40 |
await router.isReady() |
|
41 |
app.mount('#app') |
|
42 |
} |
|
43 |
|
|
44 |
declare global { |
|
45 |
interface Window { |
|
46 |
// 是否存在无界 |
|
47 |
__POWERED_BY_WUJIE__?: boolean |
|
48 |
// 子应用mount函数 |
|
49 |
__WUJIE_MOUNT: () => void |
|
50 |
// 子应用unmount函数 |
|
51 |
__WUJIE_UNMOUNT: () => void |
|
52 |
// 子应用无界实例 |
|
53 |
__WUJIE: { mount: () => void } |
|
54 |
$wujie: any |
|
55 |
} |
|
56 |
} |
|
57 |
if (window.__POWERED_BY_WUJIE__) { |
|
58 |
// console.log(window.$wujie) |
|
59 |
window.__WUJIE_MOUNT = () => { |
|
60 |
setupAll() |
|
61 |
} |
|
62 |
window.__WUJIE_UNMOUNT = () => { |
|
63 |
app.unmount() |
|
64 |
} |
|
65 |
window.__WUJIE.mount() |
|
66 |
} else { |
|
67 |
setupAll() |
|
68 |
} |