Przeglądaj źródła

文章全屏模式修改

gcj 3 lat temu
rodzic
commit
7b3a1a3d40
1 zmienionych plików z 9 dodań i 0 usunięć
  1. 9 0
      src/components/Adult/preview/Voicefullscreen.vue

+ 9 - 0
src/components/Adult/preview/Voicefullscreen.vue

@@ -698,6 +698,7 @@ export default {
       recordPlaying: false,
       isCollArr: [],
       enwords: "",
+      screenHeight: 0,
     };
   },
   computed: {
@@ -750,6 +751,7 @@ export default {
         if (val) {
           setTimeout(() => {
             _this.cardHeight = _this.$refs.wordcard.offsetHeight;
+            console.log(_this.cardHeight, _this.screenHeight, _this.clientY);
             if (_this.screenHeight - _this.clientY > _this.cardHeight) {
               _this.top = _this.clientY + 20;
             } else {
@@ -1155,6 +1157,9 @@ export default {
       });
       this.newWordList = JSON.parse(JSON.stringify(NewWordList));
     },
+    getScreenHeight() {
+      this.screenHeight = window.innerHeight;
+    },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {
@@ -1163,6 +1168,10 @@ export default {
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
     let _this = this;
+    $(window).resize(() => {
+      _this.getScreenHeight();
+    });
+    _this.getScreenHeight();
     document.addEventListener("keyup", function (e) {
       if (_this.isKeyboard) {
         if (e.keyCode == 32) {