Преглед изворни кода

渲染时title报红,切换时file文件渲染

yuanyiming пре 1 година
родитељ
комит
dc17326f79

+ 1 - 1
src/components/pages/testStudent/view/component/course.vue

@@ -1,6 +1,6 @@
 <template>
     <div class="c_box">
-        <div class="choice_box" v-loading="isloading">
+        <div class="choice_box" v-loading="isloading" v-if="checkJson">
             <div class="title" style="display: flex;">
                 <span style="min-width: fit-content;">{{ tindex + 1 + "、" }}</span>
                 <span>{{ checkJson.title }}</span>

+ 1 - 1
src/components/pages/testStudent/view/component/eva.vue

@@ -1,6 +1,6 @@
 <template>
     <div class="c_box">
-        <div class="choice_box">
+        <div class="choice_box" v-if="checkJson">
             <div class="title" style="display: flex;">
                 <span style="min-width: fit-content;">{{ tindex + 1 + "、" }}</span>
                 <span>{{ checkJson.title }}</span>

+ 4 - 1
src/components/pages/testStudent/view/component/file.vue

@@ -223,7 +223,7 @@ export default {
             deep: true
         },
         cJson: {
-            handler(newValue) {
+            handler(newValue,oldVal) {
                 if(newValue.file && this.checkJson.file && newValue.file.length !== this.checkJson.file.length){
                     this.checkJson = this.depthCopy(newValue)
                     this.$forceUpdate()
@@ -233,6 +233,9 @@ export default {
                 }else if(!newValue.file && this.checkJson.file){
                     this.checkJson = this.depthCopy(newValue)
                     this.$forceUpdate()
+                }else if (JSON.stringify(newValue) !== JSON.stringify(oldVal)) {
+                    this.checkJson = this.depthCopy(newValue)
+                    this.$forceUpdate()
                 }
             },
             deep: true