import Vue from "vue";
|
import App from "./App.vue";
|
import less from "less";
|
import "./books/childHealth/assets/main.less";
|
import ElementUI from "element-ui";
|
import "element-ui/lib/theme-chalk/index.css";
|
import store from "./store";
|
|
Vue.config.productionTip = false;
|
|
// 自定义配置
|
import config from "@/assets/js/config";
|
Vue.prototype.config = config;
|
|
// 请求处理
|
import MG from "@/assets/js/middleGround/WebMiddleGroundApi";
|
Vue.prototype.MG = MG;
|
|
//工具类
|
import toolClass from "./assets/js/toolClass";
|
Vue.prototype.tool = toolClass;
|
|
// 时间处理
|
import moment from "moment";
|
Vue.prototype.moment = moment;
|
|
Vue.use(less);
|
Vue.use(ElementUI);
|
|
let instance = null;
|
|
function render(actions = {}) {
|
// const { container } = props;
|
instance = new Vue({
|
// router,
|
actions,
|
store,
|
render: (h) => h(App)
|
}).$mount(actions.container ? actions.container.querySelector("#app") : "#app");
|
}
|
|
// 独立运行时
|
if (!window.__POWERED_BY_QIANKUN__) {
|
render();
|
}
|
|
// qiankun
|
export async function bootstrap() {}
|
export async function mount(props) {
|
console.log(props, "子层获取的props");
|
props.onGlobalStateChange((state, prev) => {
|
// state: 变更后的状态; prev 变更前的状态
|
console.log("子层change:",state, prev);
|
if (state.bb) state.bb(123)
|
});
|
|
props.setGlobalState({
|
aa: 2
|
});
|
|
render(props);
|
}
|
export async function unmount() {
|
instance.$destroy();
|
instance.$el.innerHTML = "";
|
instance = null;
|
}
|
|
// new Vue({
|
// store,
|
// render: (h) => h(App)
|
// }).$mount("#app");
|