闫增涛
5 小时以前 0f108edec5986c342009c080f48c2b1cf2d1175f
src/books/hotelEnglishTrainingBrochure2nd/view/components/index.vue
@@ -37,11 +37,14 @@
              :showPageList="loadPageList"
              :interfaceQuestion="questionDataMap"
            ></chapterFive>  -->
    </div>
      <translateWord :pageX="pageX" :pageY="pageY" :showWord="showWord" v-if="showWord" />
  </div>
</template>
<script>
import translateWord from "@/components/translateWord/index.vue";
import pageHeader from "./header.vue";
import chapterOne from "./chapter001.vue";
//   import chapterTwo from "./chapter002.vue";
@@ -75,6 +78,9 @@
      audioPath: "",
      currentTime: null,
      videoList: [],
      pageX:0,
      pageY:0,
      showWord:"",
    };
  },
  computed: {
@@ -117,6 +123,7 @@
          this.initViewer();
          this.closeAudio();
          this.closeVideo();
          this.handleTanslateWord()
        }, 200);
      },
    },
@@ -952,8 +959,26 @@
        dom.style.fontSize = fs + "px";
      }
    },
    handleTanslateWord() {
      const doms = (
        this.container ? this.container : document
      ).querySelectorAll(".ts-word");
      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);
        };
        dom.onmouseleave = () => {
          this.showWord = ""
        };
      }
    }
  },
  components: {
    translateWord,
    pageHeader,
    chapterOne,
    //   chapterTwo,
@@ -966,8 +991,6 @@
<style lang="less" scoped>
.page-main {
  .page-content {
    max-width: 816px;
    min-width: 375px;