UNPKG

xlb-main-login

Version:

``` yarn install ```

168 lines (155 loc) 4.68 kB
import 'babel-polyfill' // 使浏览器适配 import Vue from 'vue' import App from './App' import router from './router' import fastclick from 'fastclick' import Print from 'vue-print-nb' import store from './store' // 引入store import { Cascader, Table, TableColumn, Tooltip } from 'element-ui' import 'element-ui/lib/theme-chalk/index.css' import './permission' // permission control import action from './utils/action' import validate from './utils/validate' import { axios } from './utils/request' import 'ant-design-vue/dist/antd.less' import './theme/main.less' import './theme/moban.less' import './common/stylus/newMain.less' import './public-path' // 引入mockjs // import './mock/index' // 引入乾坤 // import { start } from 'qiankun' // 引入插件 import './plugin' import xlbInfo from './components/xlbInfo/xlbInfo.vue' import $xlbInfo from './components/xlbInfo/index' import xlbShop from './components/xlbShop/xlbShop.vue' import $xlbShop from './components/xlbShop/index' import './components/xlbIcon/xlb-icon' import actions from '@/actions' // const apps = [ // { // name: 'vueApp', // 应用的名字 // entry: process.env.VUE_APP_API_MALL, // 默认会加载这个html 解析里面的js 动态的执行 (子应用必须支持跨域)fetch // // entry: '//localhost:8080', // 默认会加载这个html 解析里面的js 动态的执行 (子应用必须支持跨域)fetch // container: '#vue', // 容器名 // activeRule: '/#/homereport/work', // 激活的路径 // props: xlbData, // }, // { // name: 'vueApp2', // 应用的名字 // entry: '//localhost:8082', // 默认会加载这个html 解析里面的js 动态的执行 (子应用必须支持跨域)fetch // container: '#vue2', // 容器名 // activeRule: '/home/vue2', // 激活的路径 // props: xlbData, // }, // ] // registerMicroApps(apps) // 注册应用 // Vue.use(ApmVuePlugin, { // router, // config: { // serviceName: 'xlb-web', // serverUrl: 'http://xiaoliebian.net:8200/', // pageLoadSampled: true, // pageLoadTransactionName: '/index', // }, // }) function render(props) { if (props) { actions.setActions(props) } // const xlbData = { // // sex: '男', // // age: 18, // // userName: '小东', // axios: axios, // router: router, // } // const xlb = initGlobalState(xlbData) // // 主项目项目监听和修改(在项目中任何需要监听的地方进行监听) // xlb.onGlobalStateChange((state, prev) => { // // state: 变更后的状态; prev 变更前的状态 // // console.log('主项目 改变前的值 ', prev) // // console.log('主项目 改变后的值 ', state) // }) // 将xlb对象绑到Vue原型上,为了项目中其他地方使用方便 // Vue.prototype.$xlb = xlb // setTimeout(() => { // start({ // sandbox: { // experimentalStyleIsolation: true, // }, // prefetch: false, // 取消预加载 // }) // 开启 // }, 500) Vue.prototype.$axios = axios Vue.use(Print) //注册 Vue.use(Table) Vue.use(Tooltip) Vue.use(TableColumn) Vue.use(Cascader) Vue.use(action) Vue.use(validate) Vue.use($xlbInfo) Vue.use($xlbShop) Vue.component('xlbInfo', xlbInfo) Vue.component('xlbShop', xlbShop) Vue.directive('focus', { // 当被绑定的原色插入到DOM中时 inserted(el) { // 聚焦元素 el.focus() }, }) Vue.config.productionTip = false fastclick.attach(document.body) router.afterEach((to, from) => { if (from.name === 'work.growth.fission.form.update') { window.location.reload() } }) /* eslint-disable no-new */ new Vue({ el: '#app', router, store, components: { App }, template: '<App/>', }) // if (props.initialPath) { // router.push({ name: 'login' }) // } console.log(13111222, props) if (props.setPath) { router.push({ name: 'login' }) } // } export async function bootstrap() { console.log('VueMicroApp bootstraped') } /** * 新增: * 应用每次进入都会调用 mount 方法,通常我们在这里触发应用的渲染方法 */ export async function mount(props) { // console.log('VueMicroApp mount', props) // render() render(props) } /** * 新增: * 应用每次 切出/卸载 会调用的方法,通常在这里我们会卸载微应用的应用实例 */ export async function unmount() { console.log(1111) console.log('VueMicroApp unmount') // instance.$destroy() // instance = null } console.log(4551, window) // 新增:独立运行时,直接挂载应用 if (!window.__POWERED_BY_QIANKUN__) { render() }