| | |
| | | <template> |
| | | <div class="page-main" @scroll="throttledScrollHandler"> |
| | | <div class="page-content" :style="{fontSize: fontSize ? fontSize + 'px' : '16px', |
| | | transform: `scale(${pageZoom ? pageZoom : 1})`}"> |
| | | <div |
| | | class="page-content" |
| | | > |
| | | <pageHeader v-if="showCatalogList.indexOf(0) > -1"></pageHeader> |
| | | <chapterOne v-if="showCatalogList.indexOf(1) > -1"></chapterOne> |
| | | <chapterTwo v-if="showCatalogList.indexOf(2) > -1"></chapterTwo> |
| | |
| | | throttledScrollHandler: null, |
| | | observer: null |
| | | }; |
| | | }, |
| | | computed:{ |
| | | fontSize() { |
| | | return this.$store.state.qiankun.fontSize |
| | | }, |
| | | pageZoom() { |
| | | return this.$store.state.qiankun.scale / 100 |
| | | } |
| | | }, |
| | | watch: { |
| | | showCatalogList: { |
| | |
| | | } |
| | | }, |
| | | initObservation() { |
| | | const sections = document.querySelectorAll(".page-box"); |
| | | const sections = ( |
| | | this.container ? this.container : document |
| | | ).querySelectorAll(".page-box"); |
| | | //observer 观察每个元素,以便在它们进入或离开视窗时触发回调函数。 |
| | | sections.forEach((section) => { |
| | | const isObserver = section.getAttribute("observer"); |