From 2758ef878703461ea9e7bbd4dd7ad91fb61d24e3 Mon Sep 17 00:00:00 2001 From: YM <479443481@qq.com> Date: 星期六, 11 五月 2024 17:02:55 +0800 Subject: [PATCH] 组件通信 --- .gitignore | 1 + vue.config.js | 11 +++++++++++ src/main.js | 19 +++++++++++++++---- src/books/childHealth/view/content/index.vue | 6 +++--- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 403adbc..9553f0f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .DS_Store node_modules /dist +dist.* # local env files diff --git a/src/books/childHealth/view/content/index.vue b/src/books/childHealth/view/content/index.vue index 0e7cad7..0c06b65 100644 --- a/src/books/childHealth/view/content/index.vue +++ b/src/books/childHealth/view/content/index.vue @@ -1,10 +1,10 @@ <template> <div class="page-content"> - <!-- <chapterOne></chapterOne> - <chapterTwo></chapterTwo> --> + <chapterOne></chapterOne> + <chapterTwo></chapterTwo> <!-- <chapterThree></chapterThree> --> <!-- <chapterFour></chapterFour> --> - <chapterFive></chapterFive> + <!-- <chapterFive></chapterFive> --> <!-- <chapterSix></chapterSix> <chapterSeven></chapterSeven> <chapterEight></chapterEight> diff --git a/src/main.js b/src/main.js index 96fd090..1042e4d 100644 --- a/src/main.js +++ b/src/main.js @@ -46,6 +46,17 @@ // qiankun export async function bootstrap() {} export async function mount(props) { + console.log(props, "瀛愬眰鑾峰彇鐨刾rops"); + 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() { @@ -54,7 +65,7 @@ instance = null; } -new Vue({ - store, - render: (h) => h(App) -}).$mount("#app"); +// new Vue({ +// store, +// render: (h) => h(App) +// }).$mount("#app"); diff --git a/vue.config.js b/vue.config.js index 8078cb6..1c87ace 100644 --- a/vue.config.js +++ b/vue.config.js @@ -3,6 +3,17 @@ publicPath: "./", transpileDependencies: true, lintOnSave: false, + // devServer: { + // open: true, + // historyApiFallback: true, + // allowedHosts: "all", + // headers: { + // "access-control-allow-origin": "*", + // }, + // client: { + // overlay: { warnings: false, errors: true } + // } + // }, configureWebpack: { output: { library: `app-content`, -- Gitblit v1.9.1