From 47082097dc4bbf244a94e5a05fb8d9bb38ee8750 Mon Sep 17 00:00:00 2001
From: lohir <3399054449@qq.com>
Date: 星期四, 17 十月 2024 10:23:37 +0800
Subject: [PATCH] 解决在线培训,分页bug

---
 src/views/train/index.vue |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/src/views/train/index.vue b/src/views/train/index.vue
index 63a4ffd..9a32761 100644
--- a/src/views/train/index.vue
+++ b/src/views/train/index.vue
@@ -31,7 +31,16 @@
               </div>
 
               <div class="card-footer flex justify-center mb-7 shrink-0">
-                <el-pagination background layout="prev, pager, next" :total="1000" />
+                <el-pagination
+                    background
+                    layout="total, sizes, prev, pager, next, jumper"
+                    :total="total"
+                    :page-sizes="[10, 20, 50]"
+                    :page-size="pageSize"
+                    :currentPage="currentIndex"
+                    @size-change="handleSizeChange"
+                    @current-change="handleCurrentChange"
+                />
               </div>
             </div>
           </el-card>
@@ -53,11 +62,16 @@
 
 const loading = ref(false);
 
+const currentIndex = ref(1);
+const pageSize = ref(10);
+const total = ref(0);
+
 const getData = () => {
   loading.value = true;
   getMeetList({meetName: searchText.value}).then(res => {
     dataList.value = res.data;
     loading.value = false;
+    total.value = res.total;
   }).catch(err => {
     loading.value = false;
   });
@@ -65,6 +79,17 @@
 
 getData();
 
+const handleCurrentChange = (val) => {
+  currentIndex.value = val;
+  getData();
+};
+
+const handleSizeChange = (val) => {
+  currentIndex.value = 1;
+  pageSize.value = val;
+  getData();
+};
+
 const searchData = () => {
   getData();
 

--
Gitblit v1.8.0