| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- import { createApp } from 'vue'
- import ElementPlus from 'element-plus'
- import zhCn from 'element-plus/es/locale/lang/zh-cn'
- import CacpUI from '@cacp/ui'
- import 'normalize.css/normalize.css'
- import 'element-plus/dist/index.css' //先引入element plus样式
- import '@cacp/ui/dist/index.css' //后引入@cacp/ui样式
- import './assets/main.less'
- import App from './App.vue'
- import router from './router'
- import plugins from './plugins'
- import directives from './directives'
- import { pinia } from './stores'
- import { addEventListener } from './utils/frame'
- import { BridgeCore } from '@cacp/bridge-core'
- import DictTag from '@/components/DictTag/dictTag.vue'
- import { getDict } from '@/utils/dict'
- // 初始化通信实例
- const bridge = new BridgeCore({
- allowedOrigins: [], //门户地址
- source: 'subApp'
- })
- const app = createApp(App)
- // 注册全局字典属性
- app.config.globalProperties.$dict = {
- get: getDict,
- type: async (dictType: string) => {
- return await getDict(dictType)
- }
- }
- // 声明全局属性类型
- declare module 'vue' {
- interface ComponentCustomProperties {
- $dict: {
- get: (dictType: string) => Promise<any[]>
- type: (dictType: string) => Promise<any[]>
- }
- }
- }
- app.use(router)
- app.use(plugins)
- app.use(directives)
- app.use(pinia)
- app.component('DictTag', DictTag)
- // 绑定message监听,addEventListener中调用了store,所以需要放在app.use(pinia)之后调用。
- addEventListener(bridge)
- app.use(ElementPlus, {
- locale: zhCn
- })
- app.use(CacpUI)
- app.mount('#app')
|