unknown
2024-05-23 355fc8c75e23e2c6300f84fef61a8bc8335c3584
src/books/lifeCare/index.vue
@@ -9,17 +9,13 @@
    }"
  >
    <front001 v-if="showCatalogList.indexOf(0) > -1" />
    <front002 v-if="showCatalogList.indexOf(0) > -1" />
    <front003 v-if="showCatalogList.indexOf(0) > -1" />
    <front004  v-if="showCatalogList.indexOf(0) > -1"/>
    <front005 v-if="showCatalogList.indexOf(0) > -1" />
    <front006 v-if="showCatalogList.indexOf(0) > -1" />
    <ChapterOne v-if="showCatalogList.indexOf(1) > -1" />
    <ChapterTwo v-if="showCatalogList.indexOf(2) > -1" />
    <ChapterThree v-if="showCatalogList.indexOf(3) > -1" />
    <ChapterFour v-if="showCatalogList.indexOf(4) > -1" />
    <ChapterFive  v-if="showCatalogList.indexOf(5) > -1" />
    <chapterSix v-if="showCatalogList.indexOf(6) > -1" />
    <!-- <ChapterTwo v-if="showCatalogList.indexOf(2) > -1" /> -->
    <!-- <ChapterThree v-if="showCatalogList.indexOf(3) > -1" /> -->
    <!-- <ChapterFour v-if="showCatalogList.indexOf(4) > -1" /> -->
    <!-- <ChapterFive  v-if="showCatalogList.indexOf(5) > -1" /> -->
    <!-- <chapterSix v-if="showCatalogList.indexOf(6) > -1" /> -->
    <chapterSix />
    <!-- <chapterSeven /> -->
    <!-- <chapterEight /> -->
    <!-- <chapterNine /> -->
@@ -37,11 +33,6 @@
<script>
import front001 from "./view/front001";
import front002 from "./view/front002";
import front003 from "./view/front003";
import front004 from "./view/front004";
import front005 from "./view/front005";
import front006 from "./view/front006";
import ChapterOne from "./view/chapter001";
import ChapterTwo from "./view/chapter002";
import ChapterThree from "./view/chapter003";
@@ -70,8 +61,8 @@
      throttleThreshold: 100, // 节流阈值
      previousScrollTop: 0,
      throttledScrollHandler: null,
      observer: null
    }
      observer: null,
    };
  },
  watch: {
    showCatalogList: {
@@ -82,7 +73,7 @@
        ) {
          // 调用父层方法
          this.$store.state.qiankun.catalogChange({
            showCatalogList: newVal
            showCatalogList: newVal,
          });
        }
        // 启动页码观察
@@ -90,12 +81,12 @@
          this.initObservation();
          this.initThemeColor();
        }, 500);
      }
    }
      },
    },
  },
  mounted() {
        // 默认加载章节
        this.showCatalogList = [0];
    // 默认加载章节
    this.showCatalogList = [0];
    // 滚动监听节流
    this.throttledScrollHandler = _.throttle(
      this.scrollFun,
@@ -116,7 +107,7 @@
        // 删除笔记、高亮、划线
        delSign: (data) => {
          this.delSign(data);
        }
        },
      });
    }
@@ -125,7 +116,7 @@
    this.observer = new IntersectionObserver(this.pageChangeCallback, {
      root: null, // 指定根元素,这里设为 null,表示选取整个视窗作为根元素。
      rootMargin: "0px", // 指定根元素的边界,这里设为 "0px",表示根元素的边界和视窗的边界重合
      threshold: 0.5 // 指定交叉比例,这里设为 0.5,表示当目标元素一半或更多显示在视窗中时触发回调函数。
      threshold: 0.5, // 指定交叉比例,这里设为 0.5,表示当目标元素一半或更多显示在视窗中时触发回调函数。
    });
    // 启动页码观察
@@ -155,11 +146,6 @@
  },
  components: {
    front001,
    front002,
    front003,
    front004,
    front005,
    front006,
    ChapterOne,
    ChapterTwo,
    ChapterThree,
@@ -238,9 +224,8 @@
      }
    },
        // 滚动监听
        scrollFun(event) {
    // 滚动监听
    scrollFun(event) {
      // 判断向上滚动还是向下滚动
      if (event.target.scrollTop > this.previousScrollTop) {
        // 向下
@@ -294,7 +279,7 @@
          this.showCatalogList = [
            this.catalogLength - 2,
            this.catalogLength - 1,
            this.catalogLength
            this.catalogLength,
          ];
        } else {
          this.showCatalogList = [catalog - 1, catalog, catalog + 1];
@@ -402,7 +387,7 @@
      const borderColorDom = (
        this.container ? this.container : document
      ).querySelectorAll(".theme-border");
      console.log(this.config,'this.configthis.config');
      console.log(this.config, "this.configthis.config");
      // 获取配置的主题色
      const bookThemeColor =
        this.config.activeBook && this.config.activeBook.bookThemeColor
@@ -497,7 +482,7 @@
          if (this.$store.state.qiankun && this.$store.state.qiankun.pageChange)
            this.$store.state.qiankun.pageChange({
              page: page,
              catalog: catalog
              catalog: catalog,
            });
          // const sections = Array.from(document.querySelectorAll(".section"));
          //sections:获取所有具有 .section 类名的元素,并转换为数组。
@@ -505,11 +490,11 @@
          //index:查找当前目标元素在 sections 数组中的索引,并加 1,用于确定当前页码。
        }
      });
    }
    },
  },
};
</script>
<style lang="less">
@import './css/default.less';
@import "./css/default.less";
</style>