liyongli hai 1 ano
pai
achega
2e02ef58ad
Modificáronse 1 ficheiros con 12 adicións e 4 borrados
  1. 12 4
      src/components/editor.vue

+ 12 - 4
src/components/editor.vue

@@ -6,7 +6,11 @@
       ref="editor"
       @input="input"
     ></div>
-    <div v-if="!rawText" class="defaultText" v-html="defaultSl + dfaultText"></div>
+    <div
+      v-if="!rawText"
+      class="defaultText"
+      v-html="defaultSl + dfaultText"
+    ></div>
   </div>
 </template>
 <script>
@@ -24,17 +28,21 @@ export default {
   data() {
     return {
       dfaultText: config.base.default_text || '',
-      defaultSl: '<p style="margin: 10px auto; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 16px; line-height: 34.2px; font-family: &quot;Microsoft Yahei&quot;  color: rgb(51, 51, 51); background-color: rgb(255, 255, 255);"><span>(示例)</span></p>' 
+      defaultSl:
+        '<p style="margin: 10px auto; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 16px; line-height: 34.2px; font-family: &quot;Microsoft Yahei&quot;  color: rgb(51, 51, 51); background-color: rgb(255, 255, 255);"><span>(示例)</span></p>',
     };
   },
   watch: {
     rawText(val) {
-        
       this.$refs.editor.innerHTML = val;
     },
   },
   beforeMount() {},
-  methods: {},
+  methods: {
+    input(e) {
+      this.$emit('update:rawText', e.target.innerHTML || '');
+    },
+  },
   emits: ['update:rawText'],
 };
 </script>