src/hooks/usePaginationApi.jsx
@@ -1,6 +1,7 @@
import { ref, reactive, watchEffect, unref } from "vue";
import useFormData from "@/hooks/useFormData";
import { deepClone, isEqual } from "@/utils/index.js"
import { ElMessage } from 'element-plus'
/**
 * 分页api
@@ -27,7 +28,7 @@
  /** 分页配置 */
  const pagination = reactive({
    pageSize: 10,
    pageSize: 100,
    currentPage: 1,
    pageSizes: [10, 15, 20],
    total: 0,
@@ -75,6 +76,7 @@
  }
  async function getTableData() {
    // 如果这次和上次的filter不同,那么就重置页码
    if (!isEqual(unref(filters), lastFilters)) {
      pagination.currentPage = 1;
@@ -85,8 +87,8 @@
      ...getFinalParams(),
      current: pagination.currentPage,
      size: pagination.pageSize
    }).then(({ code, data, ...rest }) => {
      if (code == 200) {
    }).then(({ code, data, msg, ...rest }) => {
      if (code === 200) {
        // pagination.currentPage = meta.current_page;
        // pagination.pageSize = meta.per_page;
        pagination.total = data.total;
@@ -96,9 +98,13 @@
        loading.value = false;
      } else {
        loading.value = false;
        ElMessage({ message: data.msg, type: "error" });
        ElMessage({ message: msg, type: "error" });
      }
    });
    }).catch(() => {
        loading.value = false;
        ElMessage({ message: msg, type: "error" });
    }).finally(() => {});
  }
  function onSizeChange(val) {