闫增涛
2024-05-14 3b9668925cee7a1fd371a5c36e9c149c6ea6346c
src/books/childHealth/view/content/index.vue
@@ -48,8 +48,18 @@
      loadThreshold: 300, // 触发加载阈值
      throttleThreshold: 100, // 节流阈值
      previousScrollTop: 0,
      throttledScrollHandler: null
      throttledScrollHandler: null,
    };
  },
  watch: {
    showCatalogList: {
      handler(newVal) {
        console.log("显示章节", newVal);
        this.$store.state.qiankun.windowSelection({
          showCatalogList: newVal,
        });
      },
    },
  },
  mounted() {
    // 默认加载章节
@@ -63,7 +73,6 @@
  },
  methods: {
    scrollFun(e) {
      // 判断向上滚动还是向下滚动
      if (event.target.scrollTop > this.previousScrollTop) {
        console.log("向下滚动");
@@ -103,10 +112,11 @@
          }
        }
      }
      // showCatalogList 当前显示的三个章节,watch监听传递给主应用
      console.log(this.showCatalogList);
      // 更新上一次滚动的位置
      this.previousScrollTop = event.target.scrollTop;
    }
    },
  },
  components: {
    pageHeader,
@@ -122,8 +132,8 @@
    chapterTen,
    chapterEleven,
    chapterTwelve,
    chapterThirteen
  }
    chapterThirteen,
  },
};
</script>