瀏覽代碼

删除mock数据,加loading

cxmo 1 年之前
父節點
當前提交
6dabb9ba53
共有 1 個文件被更改,包括 18 次插入34 次删除
  1. 18 34
      src/views/update/Index.vue

+ 18 - 34
src/views/update/Index.vue

@@ -1,51 +1,35 @@
 <script setup>
 import { onMounted , ref , reactive} from 'vue';
 import {apiLogMenu,apiLogList} from '@/api/updateLog';
+import { ElLoading } from 'element-plus'
 
 const MenuList = ref([])
 let logList = ref([])
 let activeMenu = ref('')
+let listLoading = ref(false)
 function getLogList(dateStr=''){
-    //mock
-    logList.value = [
-        {
-            "date_flag": "2023年10月", 
-            expand:true,
-            "list": [
-                {
-                    "version": "1.0.3", 
-                    "content": "<p>aaa</p>", 
-                    "update_date": "2023-10-02" ,
-                    expand:true
-                },
-                {
-                    "version": "1.0.2", 
-                    "content": "<p>aaa</p><p>bbb</p>", 
-                    "update_date": "2023-10-01" ,
-                    expand:true
-                }
-            ] 
-        }
-    ]
-   /*  apiLogList({
+    logList.value=[]
+    listLoading.value = true
+    apiLogList({
         date_flag:dateStr
     }).then(res=>{
         if(res.code!==200) return 
-        logList.value = res.data
-    }) */
+        logList.value = res.data.map(list=>{
+            list.expand = true
+            list.list = list.list.map(item=>{
+                item.expand = true
+                return item
+            })
+            return list
+        })
+        listLoading.value = false
+    })
 }
 function getLogMenu(){
-    //mock
-    MenuList.value = [
-        "2023年10月",
-        "2023年9月",
-        "2023年8月",
-        "2023年7月"
-    ]
-    /* apiLogMenu().then(res=>{
+    apiLogMenu().then(res=>{
         if(res.code!==200) return 
         MenuList.value = res.data
-    }) */
+    })
 }
 function changeActiveMenu(menu){
     activeMenu.value = menu
@@ -80,7 +64,7 @@ onMounted(()=>{
                     >{{menu}}</li>
             </ul>
         </div>
-        <div class="right side">
+        <div class="right side" v-loading="listLoading">
             <div class="log-list-wrap" v-for="(list,index) in logList" :key="list.date_flag">
                 <h2 class="list-title">{{list.date_flag}}
                     <el-icon @click="changeExpand('list',index)"