From 1db8ceb3c8b794df374104834221bdbb84260e23 Mon Sep 17 00:00:00 2001 From: YM <479443481@qq.com> Date: 星期一, 13 五月 2024 14:52:15 +0800 Subject: [PATCH] 处理应用间通信 --- src/main.js | 24 ++++++++++++++++++------ 1 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/main.js b/src/main.js index 4c7b792..07be28c 100644 --- a/src/main.js +++ b/src/main.js @@ -1,8 +1,7 @@ import Vue from "vue"; import App from "./App.vue"; import less from "less"; -import "./assets/style/base.css"; -import "./assets/style/main.css"; +import "./books/childHealth/assets/main.less"; import ElementUI from "element-ui"; import "element-ui/lib/theme-chalk/index.css"; import store from "./store"; @@ -47,6 +46,18 @@ // qiankun export async function bootstrap() {} export async function mount(props) { + console.log(props, "瀛愬眰propspropspropsprops"); + props.onGlobalStateChange((state, prev) => { + // state: 鍙樻洿鍚庣殑鐘舵��; prev 鍙樻洿鍓嶇殑鐘舵�� + console.log("瀛愬眰鍙樺寲锛�", state, prev); + // 鐘舵�佸彉鍖栧悓姝uex锛岀敤浜庡悇椤甸潰璋冪敤 + store.commit("setQiankun", state); + }); + + props.setGlobalState({ + state: 3 // 搴旂敤鎸傝浇瀹屾垚锛屽悓鏃剁敤浜庤Е鍙戜竴娆tateChange灏唖tate鎸傝浇鍦╲uex褰撲腑 + }); + render(props); } export async function unmount() { @@ -55,7 +66,8 @@ instance = null; } -new Vue({ - store, - render: (h) => h(App) -}).$mount("#app"); +// 澧炲姞 update 閽╁瓙浠ヤ究涓诲簲鐢ㄦ墜鍔ㄦ洿鏂板井搴旂敤 +// export async function update(props) { +// render(props); +// } + -- Gitblit v1.9.1