YM
2024-05-11 2758ef878703461ea9e7bbd4dd7ad91fb61d24e3
组件通信
4个文件已修改
37 ■■■■ 已修改文件
.gitignore 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/books/childHealth/view/content/index.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main.js 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
vue.config.js 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.gitignore
@@ -1,6 +1,7 @@
.DS_Store
node_modules
/dist
dist.*
# local env files
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>
src/main.js
@@ -46,6 +46,17 @@
// 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() {
@@ -54,7 +65,7 @@
  instance = null;
}
new Vue({
  store,
  render: (h) => h(App)
}).$mount("#app");
// new Vue({
//   store,
//   render: (h) => h(App)
// }).$mount("#app");
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`,