浏览代码

保存表格字体

natasha 3 小时之前
父节点
当前提交
fe0ed0ea26

+ 7 - 4
src/views/book/courseware/create/components/question/table/Table.vue

@@ -456,10 +456,13 @@ export default {
     'data.unified_attrib': {
       handler(val) {
         if (val) {
-          this.data.styles.fontFamily = this.data?.unified_attrib?.font || '楷体,微软雅黑';
-          this.data.styles.fontSize = this.data?.unified_attrib?.font_size || '12pt';
-          this.data.styles.fontColor = this.data?.unified_attrib?.text_color || '#1d2129';
-          this.data.styles.textAlign = this.data?.unified_attrib?.align || '';
+          this.attrib = JSON.parse(JSON.stringify(val));
+          if (this.property.isSilentPropertyWatch && !this.data.styles.fontFamily) {
+            this.data.styles.fontFamily = this.attrib.font ? this.attrib.font : '楷体,微软雅黑';
+            this.data.styles.fontSize = this.attrib.font_size ? this.attrib.font_size : '12pt';
+            this.data.styles.fontColor = this.attrib.text_color ? this.attrib.text_color : '#1d2129';
+            this.data.styles.textAlign = this.attrib.align ? this.attrib.align : '';
+          }
         }
       },
       deep: true,

+ 3 - 3
src/views/book/courseware/data/table.js

@@ -93,9 +93,9 @@ export function getTableData() {
     vocabulary: '', // 用于选词的词汇
     word_list: [], // 选词列表
     styles: {
-      fontFamily: 'Arial',
-      fontSize: '12pt',
-      fontColor: '#1d2129',
+      fontFamily: '',
+      fontSize: '',
+      fontColor: '',
       bgColor: '',
       isUnderline: false,
       isBold: false,