闫增涛
4 小时以前 cdb75e000d815c2b5a2b320ea0e6b9f3e1d29cd2
翻译组件优化
1个文件已修改
37 ■■■■■ 已修改文件
src/books/hotelEnglishTrainingBrochure2nd/view/components/index.vue 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/books/hotelEnglishTrainingBrochure2nd/view/components/index.vue
@@ -37,9 +37,13 @@
              :showPageList="loadPageList"
              :interfaceQuestion="questionDataMap"
            ></chapterFive>  -->
    </div>
      <translateWord :pageX="pageX" :pageY="pageY" :showWord="showWord" v-if="showWord" />
    <translateWord
      :pageX="pageX"
      :pageY="pageY"
      :showWord="showWord"
      v-if="showWord"
    />
  </div>
</template>
@@ -78,9 +82,9 @@
      audioPath: "",
      currentTime: null,
      videoList: [],
      pageX:0,
      pageY:0,
      showWord:"",
      pageX: 0,
      pageY: 0,
      showWord: "",
    };
  },
  computed: {
@@ -123,7 +127,7 @@
          this.initViewer();
          this.closeAudio();
          this.closeVideo();
          this.handleTanslateWord()
          this.handleTanslateWord();
        }, 200);
      },
    },
@@ -963,19 +967,24 @@
      const doms = (
        this.container ? this.container : document
      ).querySelectorAll(".ts-word");
      for(let index = 0;index < doms.length;index++){
      for (let index = 0; index < doms.length; index++) {
        const dom = doms[index];
        dom.onmouseenter = (event) => {
          this.pageX = event.pageX;
          this.pageY = event.pageY;
          this.showWord = event.target.innerText;
          console.log(event.target.innerText);
          if (this.showWord != event.target.innerText) {
            const rect = dom.getBoundingClientRect();
            this.pageX = event.pageX - rect.width;
            this.pageY = event.pageY + 20;
            this.showWord = event.target.innerText;
            console.log(event);
          }
        };
        dom.onmouseleave = () => {
          this.showWord = ""
        dom.onmouseleave = (event) => {
          if(this.showWord == event.target.innerText) {
            this.showWord = "";
          }
        };
      }
    }
    },
  },
  components: {
    translateWord,