Просмотр исходного кода

生词组件预览宽度改为clientWidth

natasha 3 недель назад
Родитель
Сommit
1c463b92e6

+ 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);
     });