zhongshujie
2024-10-25 5c23e43fd26c3cce38ac18c1b2f48d28a89960ae
src/books/civilAviation/view/components/index.vue
@@ -4,8 +4,8 @@
      <div id="searchContent"></div>
    </div>
    <div class="page-content" :style="{
      fontSize: fontSize ? fontSize + 'px' : '18px',
      transform: `scale(${pageZoom ? pageZoom : 1})`,
      fontSize: fontSize + 'px',
      transform: `scale(${pageZoom})`,
      transformOrigin: 'center top',
    }">
      <pageHeader v-if="showCatalogList.indexOf(1) > -1" :showPageList="loadPageList"></pageHeader>
@@ -47,10 +47,10 @@
  computed: {
    fontSize() {
      this.transformDom(this.$store.state.qiankun.fontSize)
      return this.$store.state.qiankun.fontSize;
      return this.$store.state.qiankun.fontSize ? this.$store.state.qiankun.fontSize : 18;
    },
    pageZoom() {
      return this.$store.state.qiankun.scale / 100;
      return this.$store.state.qiankun.scale ? this.$store.state.qiankun.scale / 100 : 1;
    },
  },
  watch: {
@@ -75,6 +75,7 @@
    loadPageList: {
      handler(newVal, oldVal) {
        setTimeout(() => {
          this.transformDom(this.$store.state.qiankun.fontSize)
          this.initSwiper();
          this.initViewer();
          this.closeAudio();
@@ -913,9 +914,14 @@
    },
    //其他类名下字体大小变化
    transformDom(fs) {
      const blockElement = this.$refs.blockElement;
      if (blockElement) {
        blockElement.style.fontSize = fs; // 或者你想要的任何大小
      if(!fs) return
      let doms = (
        this.container ? this.container : document
      ).querySelectorAll('.block')
      if(!doms.length) return
      for (let index = 0; index < doms.length; index++) {
        const dom = doms[index];
        dom.style.fontSize = fs + 'px'
      }
    }
  },