Ver código fonte

添加二级目录加载

aaa 3 anos atrás
pai
commit
19933fd303
1 arquivos alterados com 14 adições e 0 exclusões
  1. 14 0
      src/views/home/learn/page-learn-child.vue

+ 14 - 0
src/views/home/learn/page-learn-child.vue

@@ -10,8 +10,12 @@
         line-height="0px"
         @click="childChange"
       >
+        <div class="contentLoading" v-if="contentLoading">
+          <van-loading   type="spinner" vertical >加载中...</van-loading>
+        </div>
         <!-- 子目录 -->
         <van-tab
+          v-else
           v-for="(tabItem, tabIndex) in learnChildList"
           :key="tabIndex"
           :title="tabItem.name"
@@ -121,6 +125,7 @@ export default {
       contentList: [],
       loading: false,
       childLoading: true, // 子目录加载
+      contentLoading: false, // 子目录加载
       finished: false,
       learnChildList: [],
       learnPage: 0,
@@ -175,6 +180,7 @@ export default {
     },
     //   查询子目录
     getContentList() {
+      this.contentLoading = true;
       this.$store.commit("toggleLoading", true);
       let path = {
         categoryId: this.learnChildList[this.choosedChildIndex].id
@@ -198,10 +204,12 @@ export default {
           this.finished = res.data.last;
           this.learnPage++;
           this.$store.commit("toggleLoading", false);
+          this.contentLoading = false;
         })
         .catch(() => {
           Toast("系统异常");
           this.$store.commit("toggleLoading", false);
+          this.contentLoading = false;
         });
     },
     // 判断是否今日必学
@@ -250,6 +258,12 @@ export default {
     justify-content: center;
     align-items: center;
    }
+   .contentLoading{
+    height: 75vh;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+   }
   .contentItemDiv {
     width: 100%;
     .contentItemTitle {