From 6016198229e16f20be1bf55df64b9f363e27b698 Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期二, 28 五月 2024 16:27:59 +0800 Subject: [PATCH] 题目优化 --- src/main.js | 29 ++++++++++++++++------------- 1 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/main.js b/src/main.js index ee43d47..be449f0 100644 --- a/src/main.js +++ b/src/main.js @@ -1,7 +1,6 @@ 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"; @@ -11,6 +10,7 @@ // 鑷畾涔夐厤缃� import config from "@/assets/js/config"; Vue.prototype.config = config; +// Vue.prototype.thisBookConfig = await config.getBookConfig(); // 璇锋眰澶勭悊 import MG from "@/assets/js/middleGround/WebMiddleGroundApi"; @@ -29,14 +29,16 @@ let instance = null; -function render(actions = {}) { - // const { container } = props; +function render(props = {}) { + const { container, onGlobalStateChange, setGlobalState } = props; + Vue.prototype.onGlobalStateChange = onGlobalStateChange; + Vue.prototype.setGlobalState = setGlobalState; + Vue.prototype.container = container; instance = new Vue({ // router, - actions, store, render: (h) => h(App) - }).$mount(actions.container ? actions.container.querySelector("#app") : "#app"); + }).$mount(container ? container.querySelector("#app") : "#app"); } // 鐙珛杩愯鏃� @@ -47,15 +49,16 @@ // qiankun export async function bootstrap() {} export async function mount(props) { - console.log(props, "瀛愬眰鑾峰彇鐨刾rops"); + console.log(props, "瀛愬眰propspropspropsprops"); props.onGlobalStateChange((state, prev) => { // state: 鍙樻洿鍚庣殑鐘舵��; prev 鍙樻洿鍓嶇殑鐘舵�� - console.log("瀛愬眰change锛�",state, prev); - if (state.bb) state.bb(123) + console.log("瀛愬眰鍙樺寲锛�", state, prev); + // 鐘舵�佸彉鍖栧悓姝uex锛岀敤浜庡悇椤甸潰璋冪敤 + store.commit("setQiankun", state); }); props.setGlobalState({ - aa: 2 + state: 3, // 搴旂敤鎸傝浇瀹屾垚锛屽悓鏃剁敤浜庤Е鍙戜竴娆tateChange灏唖tate鎸傝浇鍦╲uex褰撲腑 }); render(props); @@ -66,7 +69,7 @@ instance = null; } -// new Vue({ -// store, -// render: (h) => h(App) -// }).$mount("#app"); +// 澧炲姞 update 閽╁瓙浠ヤ究涓诲簲鐢ㄦ墜鍔ㄦ洿鏂板井搴旂敤 +// export async function update(props) { +// render(props); +// } -- Gitblit v1.9.1