Pārlūkot izejas kodu

解决课文选择字号更改字体问题

natasha 1 stundu atpakaļ
vecāks
revīzija
e2463a9d36

+ 6 - 2
src/views/book/courseware/create/components/question/article/Article.vue

@@ -75,7 +75,7 @@
               v-model="articleAttrib.font_size"
               placeholder="请选择"
               style="width: 130px"
-              @change="data.unified_attrib.font_size = articleAttrib.font_size"
+              @change="handleChangeStyles('fontSize')"
             >
               <el-option
                 v-for="(value, index) in 16"
@@ -554,7 +554,7 @@ export default {
   created() {},
   methods: {
     // 全局样式变化
-    handleChangeStyles() {
+    handleChangeStyles(type) {
       if (this.articleAttrib.font !== this.data.other_attrib.oldFont) {
         this.data.other_attrib.oldFont = this.articleAttrib.font;
         this.data.detail.forEach((item) => {
@@ -582,6 +582,10 @@ export default {
             this.articleAttrib.align === 'RIGHT' ? 'right' : this.articleAttrib.align === 'MIDDLE' ? 'center' : 'left';
         });
       }
+      if (type === 'fontSize') {
+        this.data.unified_attrib.font_size = this.articleAttrib.font_size;
+        this.data.unified_attrib.font = this.articleAttrib.font;
+      }
     },
     // 解析输入内容
     handleChangeContent() {

+ 4 - 1
src/views/book/courseware/create/components/question/dialogue_article/Article.vue

@@ -16,7 +16,10 @@
             v-model="articleAttrib.font_size"
             placeholder="请选择"
             style="width: 130px"
-            @change="data.unified_attrib.font_size = articleAttrib.font_size"
+            @change="
+              data.unified_attrib.font_size = articleAttrib.font_size;
+              data.unified_attrib.font = articleAttrib.font;
+            "
           >
             <el-option
               v-for="(value, index) in 16"