Browse Source

修改bug

lxr 2 tháng trước cách đây
mục cha
commit
e6c998798b
1 tập tin đã thay đổi với 5 bổ sung3 xóa
  1. 5 3
      src/views/dynamicManagement/friendRelation.vue

+ 5 - 3
src/views/dynamicManagement/friendRelation.vue

@@ -278,11 +278,13 @@ const initParam = reactive({
   storeId: localGet("createdId") || ""
 });
 
-// 数据回调处理
+// 数据回调处理:兼容接口返回数组或 { records/list, total } 格式,确保有数据时分页显示正确总数
 const dataCallback = (data: any) => {
+  const list = Array.isArray(data) ? data : (data?.records ?? data?.list ?? []);
+  const total = typeof data?.total === "number" ? data.total : list.length;
   return {
-    list: data || [],
-    total: data?.total || 0
+    list,
+    total
   };
 };