main.js
2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import 'font-awesome/css/font-awesome.min.css'
import '@/assets/scss/element-variables.scss'
//import Vue from 'vue'
import ElementUI from 'element-ui';
import 'animate.css/animate.min.css'
import '@/assets/scss/style.scss'
import 'element-ui/lib/theme-chalk/index.css';
import '@/assets/spritesmith-generated/sprite.css'
import Router from 'vue-router'
import routes from '@/router'
import '@/core/public-path';
import actions from '@/core/actions';
import vLayout from '@/pages/Layout.vue'
import vFullLayout from '@/pages/FullWidthLayout.vue'
import store from '@/vuex/store.js'
import App from '@/App.vue'
import Vue from 'vue'
Vue.component('vLayout', vLayout)
Vue.component('vFullLayout', vFullLayout)
Vue.use(ElementUI)
import 'xe-utils'
import VXETable from 'vxe-table'
import 'vxe-table/lib/style.css'
Vue.use(VXETable)
// // worker多线程
// import VueWorker from 'vue-worker'
// Vue.use(VueWorker)
// 引入 公共图片组件
import GlsxImage from '@/components/glsx-image/index.vue';
Vue.component('GlsxImage', GlsxImage)
// new Vue({
// el: '#app',
// router,
// render: h => h(App)
// })
let router = null;
let instance = null;
function render({ data = {}, container } = {}) {
router = new Router({
base: window.__POWERED_BY_QIANKUN__ ? '/oEshield' : '/',
routes
});
store.commit('SET_BASE_URL', data.baseURL);
Vue.prototype.$parentCommon = data.common;
Vue.prototype.$parentRouter = data.router;
Vue.prototype.$parentVuex = data.store;
instance = new Vue({
router,
store,
data() {
return {
parentRouter: data.router,
parentVuex: data.store,
parentCommon: data.common
}
},
render: h => h(App),
}).$mount(container ? container.querySelector('#glsx-sub-system') : '#glsx-sub-system');
}
if (!window.__POWERED_BY_QIANKUN__) {
render();
}
export async function bootstrap() {
console.log('vue app bootstraped');
}
export async function mount(props) {
console.log('props from main framework', props.data);
actions.setActions(props);
Vue.prototype.$onGlobalStateChange = props.onGlobalStateChange
Vue.prototype.$setGlobalState = props.setGlobalState
render(props);
props.setGlobalState({
})
console.log(props)
}
export async function unmount() {
instance.$destroy();
instance.$el.innerHTML = "";
instance = null;
router = null;
}