Skip to content

Commit

Permalink
docs(table): fix ajax demo (#4639)
Browse files Browse the repository at this point in the history
  • Loading branch information
John60676 authored Sep 10, 2021
1 parent 6e85fd9 commit ba743b2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions components/table/demo/ajax.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ This example shows how to fetch and present data from a remote server, and how t
import type { TableProps } from 'ant-design-vue';
import { usePagination } from 'vue-request';
import { computed, defineComponent } from 'vue';
import axios from 'axios';
const columns = [
{
title: 'Name',
Expand Down Expand Up @@ -76,7 +77,7 @@ type APIResult = {
};
const queryData = (params: APIParams) => {
return `https://randomuser.me/api?noinfo&${new URLSearchParams(params)}`;
return axios.get<APIResult>('https://randomuser.me/api?noinfo', { params });
};
export default defineComponent({
Expand All @@ -87,8 +88,8 @@ export default defineComponent({
loading,
current,
pageSize,
} = usePagination<APIResult>(queryData, {
formatResult: res => res.results,
} = usePagination(queryData, {
formatResult: res => res.data.results,
pagination: {
currentKey: 'page',
pageSizeKey: 'results',
Expand Down

0 comments on commit ba743b2

Please sign in to comment.