| | |
| | | <!-- eslint-disable vue/multi-word-component-names --> |
| | | <template> |
| | | <div class="page-main" @scroll="throttledScrollHandler"> |
| | | <div |
| | |
| | | import chapter017 from "./view/chapter017"; |
| | | import chapter018 from "./view/chapter018"; |
| | | import NoteIcon from "@/assets/images/biji.png"; |
| | | import drawflow from "@/components/drawflow"; |
| | | import _ from "lodash"; |
| | | export default { |
| | | data() { |
| | |
| | | }, |
| | | watch: { |
| | | showCatalogList: { |
| | | // eslint-disable-next-line no-unused-vars |
| | | handler(newVal, oldVal) { |
| | | if ( |
| | | this.$store.state.qiankun && |
| | |
| | | showCatalogList: newVal, |
| | | }); |
| | | } |
| | | |
| | | // 启动页码观察 |
| | | setTimeout(() => { |
| | | this.initObservation(); |
| | |
| | | }, |
| | | mounted() { |
| | | // 默认加载章节 |
| | | this.showCatalogList = [5]; |
| | | this.showCatalogList = [1]; |
| | | // 滚动监听节流 |
| | | this.throttledScrollHandler = _.throttle( |
| | | this.scrollFun, |
| | |
| | | // }, 3000); |
| | | }, |
| | | components: { |
| | | drawflow, |
| | | front001, |
| | | ChapterOne, |
| | | ChapterTwo, |
| | |
| | | ).getSelection(); |
| | | const txt = selection.toString(); |
| | | if (selection.type != "none" && txt) { |
| | | // eslint-disable-next-line no-unused-vars |
| | | let node = selection.anchorNode.parentNode; |
| | | let pageHtml = this.getParentWithClass( |
| | | selection.anchorNode, |
| | |
| | | } |
| | | }); |
| | | }, |
| | | // eslint-disable-next-line |
| | | getParentWithClass(element, className) { |
| | | while (element.parentElement) { |
| | | element = element.parentElement; |
| | |
| | | } |
| | | } |
| | | }, |
| | | // eslint-disable-next-line no-unused-vars |
| | | pageChangeCallback(entries, observer) { |
| | | //entries:代表观察到的目标元素的集合。 observer:代表观察者对象。 |
| | | entries.forEach((entry) => { |
| | |
| | | } |
| | | }); |
| | | }, |
| | | }, |
| | | } |
| | | }; |
| | | </script> |
| | | |