Closed
Description
问题描述 Problem Description
我按照ant design 的示例:
<script lang="ts" setup>
import type { TableProps } from 'ant-design-vue'
import { getDemoTable } from '@/api/demo'
const columns = []
const {
data,
run,
loading,
current,
pageSize,
total
} = usePagination(getDemoTable, {
pagination: {
currentKey: 'ext.page',
pageSizeKey: 'ext.size',
totalKey: 'ext.total',
},
})
const dataSource = computed(() => data.value?.list ?? [])
const pagination = computed(() => ({
total: total.value,
current: current.value,
pageSize: pageSize.value,
}))
const onTableChange: TableProps['onChange'] = (pag, filters, sorter) => {
run({
page: pag.current,
size: pag.pageSize,
sorter: sorter,
...filters,
})
}
</script>
<template>
<a-table
:row-key="(record) => record.id"
:columns="columns"
:data-source="dataSource"
:pagination="pagination"
:loading="loading"
@change="onTableChange"
></a-table>
</template>
<style scoped lang="scss"></style>
我不太理解初次的传参为什么是这样