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

fix: 首页刷新页面展示问题

zhangjie пре 9 месеци
родитељ
комит
02341f58eb
1 измењених фајлова са 12 додато и 5 уклоњено
  1. 12 5
      src/modules/exam/views/WaitTask.vue

+ 12 - 5
src/modules/exam/views/WaitTask.vue

@@ -57,11 +57,18 @@ export default {
       return `wait-task-${this.curTab}`;
     },
   },
-  created() {
-    this.initTabs();
-    if (this.$route.query.type) {
-      this.curTab = this.$route.query.type;
-    }
+  watch: {
+    waitTypes: {
+      immediate: true,
+      handler(val) {
+        if (!val) return;
+
+        this.initTabs();
+        if (this.$route.query.type) {
+          this.curTab = this.$route.query.type;
+        }
+      },
+    },
   },
   methods: {
     initTabs() {