// 初始化多语言
|
import { setupI18n } from '@/plugins/vueI18n'
|
|
// 引入unocss css
|
import '@/plugins/unocss'
|
|
// 引入状态管理
|
import { setupStore } from '@/store'
|
|
// 全局组件
|
import { setupGlobCom } from '@/components'
|
|
// 引入 element-plus
|
import { setupElementPlus } from '@/plugins/elementPlus'
|
|
// 引入全局样式
|
import '@/styles/index.scss'
|
|
// 引入动画
|
import '@/plugins/animate.css'
|
|
// 路由
|
import router, { setupRouter } from '@/router'
|
|
import { createApp } from 'vue'
|
|
import App from './App.vue'
|
|
import './permission'
|
|
const app = createApp(App)
|
|
// 创建实例
|
const setupAll = async () => {
|
await setupI18n(app)
|
setupGlobCom(app)
|
setupElementPlus(app)
|
setupStore(app)
|
setupRouter(app)
|
await router.isReady()
|
app.mount('#app')
|
}
|
|
declare global {
|
interface Window {
|
// 是否存在无界
|
__POWERED_BY_WUJIE__?: boolean
|
// 子应用mount函数
|
__WUJIE_MOUNT: () => void
|
// 子应用unmount函数
|
__WUJIE_UNMOUNT: () => void
|
// 子应用无界实例
|
__WUJIE: { mount: () => void }
|
$wujie: any
|
}
|
}
|
if (window.__POWERED_BY_WUJIE__) {
|
// console.log(window.$wujie)
|
window.__WUJIE_MOUNT = () => {
|
setupAll()
|
}
|
window.__WUJIE_UNMOUNT = () => {
|
app.unmount()
|
}
|
window.__WUJIE.mount()
|
} else {
|
setupAll()
|
}
|