소스 검색

生词组件预览宽度改为clientWidth

natasha 3 주 전
부모
커밋
1c463b92e6
1개의 변경된 파일과 2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      src/views/book/courseware/preview/components/new_word/NewWordPreview.vue

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

@@ -1648,7 +1648,7 @@ export default {
             this.initData();
             this.$nextTick(() => {
               setTimeout(() => {
-                let totalWidth = document.querySelector('.newWord-preview').offsetWidth;
+                let totalWidth = document.querySelector('.newWord-preview').clientWidth;
                 this.width = `${totalWidth - (this.data.property.sn_display_mode === 'true' ? 15 : 0) - 1}`;
               }, 200);
             });
@@ -1682,7 +1682,7 @@ export default {
   mounted() {
     this.$nextTick(() => {
       setTimeout(() => {
-        let totalWidth = document.querySelector('.newWord-preview').offsetWidth;
+        let totalWidth = document.querySelector('.newWord-preview').clientWidth;
         this.width = `${totalWidth - (this.data.property.sn_display_mode === 'true' ? 15 : 0) - 1}`;
       }, 200);
     });