Pārlūkot izejas kodu

修改课程详情图片宽度问题

11wqe1 1 gadu atpakaļ
vecāks
revīzija
1f315e3f08
1 mainītis faili ar 7 papildinājumiem un 4 dzēšanām
  1. 7 4
      src/views/course/components/courseTitle.vue

+ 7 - 4
src/views/course/components/courseTitle.vue

@@ -36,12 +36,15 @@ export default {
   data() {
     return {}
   },
+  watch: {
+    chapInfo(newVal, oldVal) {
+      this.chapInfo.chapterInfo[0].taskJson[this.taskCount].taskDetail = this.chapInfo.chapterInfo[0].taskJson[
+        this.taskCount
+      ].taskDetail.replace(/(<img[^>]+)style="max-width:\s*100%25;"/g, '$1style="max-width:100%;"')
+    }
+  },
   mounted() {
     // let con = this.chapInfo
-    console.log('??????????????????????????????', this.chapInfo)
-    this.chapInfo.chapterInfo[0].taskJson[this.taskCount].taskDetail = this.chapInfo.chapterInfo[0].taskJson[
-      this.taskCount
-    ].taskDetail.replace(/(<img[^>]+)style="max-width:\s*100%25;"/g, '$1style="max-width:100%;"')
   }
 }
 </script>