| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- import Vue from 'vue';
- import './public-path';
- import initParentStore from '../qiankun_config/store';
- import App from './App.vue';
- import store from './store';
- import router from './router';
- import permission from './utils/permission';
- import { MAP_KEY, LICENSE_CODE } from '@/config/setting';
- import EleAdmin from 'ele-admin';
- import VueClipboard from 'vue-clipboard2';
- import i18n from './i18n';
- import './styles/index.scss';
- import DictSelection from '@/components/Dict/DictSelection';
- import HeaderTitle from '@/components/header-title';
- import authSelection from '@/components/authSelection';
- Vue.component('HeaderTitle', HeaderTitle);
- Vue.component('authSelection', authSelection);
- import print from 'vue-printjs';
- import Direction from 'vue-direction-key';
- // // register globally
- import '@/icons';
- Vue.component('DictSelection', DictSelection);
- Vue.config.productionTip = false;
- // 公共搜索文件
- import seekPage from '@/components/common/seekPage';
- Vue.component('seekPage', seekPage);
- Vue.use(EleAdmin, {
- response: {
- dataName: 'list'
- },
- mapKey: MAP_KEY,
- license: LICENSE_CODE,
- i18n: (key, value) => i18n.t(key, value)
- });
- Vue.use(permission);
- Vue.use(VueClipboard);
- Vue.use(print);
- Vue.use(Direction);
- let instance = null;
- function render(props = {}) {
- const { container, routerBase } = props;
- // const router = new VueRouter({
- // base: window.__POWERED_BY_QIANKUN__ ? routerBase : process.env.BASE_URL,
- // mode: 'history',
- // routes
- // });
- instance = new Vue({
- router,
- store,
- i18n,
- render: (h) => h(App)
- }).$mount(container ? container.querySelector('#app') : '#app');
- }
- if (!window.__POWERED_BY_QIANKUN__) {
- // 这里是子应用独立运行的环境,实现子应用的登录逻辑
- render();
- }
- export async function bootstrap() {
- console.log('[vue] vue app bootstraped');
- }
- export async function mount(props) {
- console.log('[vue] props from main framework', props);
- Vue.prototype.$portalStore = props.store;
- initParentStore(props.store);
- props.onGlobalStateChange((state, prev) => {
- // state: 变更后的状态; prev 变更前的状态
- initParentStore(state);
- });
- render(props);
- }
- export async function unmount() {
- instance.$destroy();
- instance.$el.innerHTML = '';
- instance = null;
- }
|