import { ref } from 'vue' export default function usePagination(fetch, params) { const pageNum = ref(1) const pageSize = ref(10) const tableData = ref([]) const total = ref(0) const loading = ref(false) const getTableList = async () => { loading.value = true const res = await fetch({ ...params.value, pageNum: pageNum.value, pageSize: pageSize.value }) loading.value = false if(res?.code === 200){ tableData.value = res?.data || [] total.value = res?.total || 0 } } return { pageNum, pageSize, tableData, total, loading, getTableList } }