File tree 1 file changed +4
-3
lines changed
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ This example shows how to fetch and present data from a remote server, and how t
38
38
import type { TableProps } from ' ant-design-vue' ;
39
39
import { usePagination } from ' vue-request' ;
40
40
import { computed , defineComponent } from ' vue' ;
41
+ import axios from ' axios' ;
41
42
const columns = [
42
43
{
43
44
title: ' Name' ,
@@ -76,7 +77,7 @@ type APIResult = {
76
77
};
77
78
78
79
const queryData = (params : APIParams ) => {
79
- return ` https://randomuser.me/api?noinfo&${ new URLSearchParams ( params )} ` ;
80
+ return axios . get < APIResult >( ' https://randomuser.me/api?noinfo' , { params }) ;
80
81
};
81
82
82
83
export default defineComponent ({
@@ -87,8 +88,8 @@ export default defineComponent({
87
88
loading,
88
89
current,
89
90
pageSize,
90
- } = usePagination < APIResult > (queryData , {
91
- formatResult : res => res .results ,
91
+ } = usePagination (queryData , {
92
+ formatResult : res => res .data . results ,
92
93
pagination: {
93
94
currentKey: ' page' ,
94
95
pageSizeKey: ' results' ,
You can’t perform that action at this time.
0 commit comments