Browse Source

监听生词列表宽度 避免滚动条

natasha 1 month ago
parent
commit
2eb0a72910

+ 9 - 1
src/views/book/courseware/preview/components/new_word/NewWordPreview.vue

@@ -1663,6 +1663,14 @@ export default {
           ) {
             // this.wordShow = isEnable(this.data.property.is_word_show);
             this.initData();
+            this.$nextTick(() => {
+              setTimeout(() => {
+                let totalWidth = document.querySelector('.newWord-preview').offsetWidth;
+                this.width = `${totalWidth - (this.data.property.sn_display_mode === 'true' ? 15 : 0) - 1}`;
+              }, 200);
+            });
+
+            this.dataHeight = this.$refs.previewContainer ? this.$refs.previewContainer.style.height : 0;
           }
         }
       },
@@ -1692,7 +1700,7 @@ export default {
     this.$nextTick(() => {
       setTimeout(() => {
         let totalWidth = document.querySelector('.newWord-preview').offsetWidth;
-        this.width = `${totalWidth - (this.data.property.sn_display_mode === 'true' ? 15 : 0)}`;
+        this.width = `${totalWidth - (this.data.property.sn_display_mode === 'true' ? 15 : 0) - 1}`;
       }, 200);
     });
 

+ 1 - 1
src/views/book/courseware/preview/components/table/TablePreview.vue

@@ -1459,7 +1459,7 @@ $border-color: #e6e6e6;
       font-size: 16px;
 
       span {
-        text-align: center;
+        // text-align: center; // 注释掉是为了带拼音分词后折行左对齐显示了居中对齐
       }
 
       .pinyin {