main.js
1.78 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
import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import VueRouter from "vue-router";
import App from './App.vue'
import routes from "./routes";
import store from './store'
import '@/styles/index.scss'
import '@/components'
import './core/public-path';
import { Common } from '@/utils/common.js'
import Constants from '@/utils/constants.js'
import actions from '@/core/actions';
import GlsxDialog from "@/components/dialog";
import GlMapSdk from "@/utils/glsk-mapapi-sdk";
console.log(GlMapSdk);
// import axios from 'axios'
Vue.component('glsx-dialog', GlsxDialog)
Vue.prototype.btn_size = 'mini'
Vue.prototype.$Common = Common
Vue.prototype.$Constants = Constants
Vue.use(VueRouter);
Vue.use(ElementUI)
Vue.config.productionTip = false;
Vue.prototype.mapapi = new GlMapSdk()
let router = null;
let instance = null;
function render({ data = {}, container } = {}) {
router = new VueRouter({
base: window.__POWERED_BY_QIANKUN__ ? '/system' : '/',
routes,
});
console.log(data)
store.state.baseURL = data.baseURL;
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);
render(props);
props.setGlobalState({
})
}
export async function unmount() {
instance.$destroy();
instance.$el.innerHTML = "";
instance = null;
router = null;
}