Jelajahi Sumber

优化tab初始化

aaa 3 tahun lalu
induk
melakukan
986ead55ca
2 mengubah file dengan 5 tambahan dan 4 penghapusan
  1. 4 4
      src/views/home/index.vue
  2. 1 0
      src/views/home/learn/page-learn.vue

+ 4 - 4
src/views/home/index.vue

@@ -9,7 +9,7 @@
       bind:click-right
     ></van-nav-bar>
     <div v-show="activeTabName === 0" class="dropdown-div"></div>
-    <transition name="tab" mode="out-in">
+    <transition name="tab" mode="out-in" v-if="initTable">
       <component :is="currentComponents" class="page" />
     </transition>
     <van-tabbar
@@ -40,7 +40,8 @@ export default {
   components: { PageLearn, PageAnswer, PageExam, PagePerson },
   data() {
     return {
-      currentComponents: "",
+      initTable: false,
+      currentComponents: "pageLearn",
       activeTabName: 0,
       tabbars: [
         {
@@ -159,8 +160,7 @@ export default {
       this.currentComponents = this.tabbars[this.activeTabName].pageName;
     },
     afterGetUserInfo() {
-      // 初始化当前也
-      this.currentComponents = "pageLearn";
+      this.initTable = true;
       // 获取所有收藏
       this.getCollection();
       // 获取所有考试历史

+ 1 - 0
src/views/home/learn/page-learn.vue

@@ -33,6 +33,7 @@ export default {
   },
   computed: {},
   created() {
+    console.log("-----------------learn-");
     setTimeout(() => {
       this.getLearnRootList();
     }, 500);