| | |
| | | <!-- eslint-disable vue/multi-word-component-names --> |
| | | <template> |
| | | <div class="page-main" @scroll="throttledScrollHandler"> |
| | | <div |
| | |
| | | transform: `scale(${pageZoom ? pageZoom : 1})`, |
| | | }" |
| | | > |
| | | <drawflow /> |
| | | <front001 v-if="showCatalogList.indexOf(1) > -1" /> |
| | | <ChapterOne v-if="showCatalogList.indexOf(2) > -1" /> |
| | | <ChapterTwo v-if="showCatalogList.indexOf(3) > -1" /> |
| | |
| | | }, |
| | | watch: { |
| | | showCatalogList: { |
| | | // eslint-disable-next-line no-unused-vars |
| | | handler(newVal, oldVal) { |
| | | if ( |
| | | this.$store.state.qiankun && |
| | |
| | | }, |
| | | mounted() { |
| | | // 默认加载章节 |
| | | this.showCatalogList = [5]; |
| | | this.showCatalogList = [0]; |
| | | // 滚动监听节流 |
| | | this.throttledScrollHandler = _.throttle( |
| | | this.scrollFun, |
| | |
| | | ).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> |
| | | |