From d0c61740289dd13b9541097fb25eec8e8b7691c6 Mon Sep 17 00:00:00 2001 From: Xian Yu Date: Thu, 10 Apr 2025 14:40:09 +0800 Subject: [PATCH] =?UTF-8?q?docs(table):=20ajax=20=E7=A4=BA=E4=BE=8B?= =?UTF-8?q?=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/table/demo/ajax.vue | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/table/demo/ajax.vue b/components/table/demo/ajax.vue index 3531b7fbc8..724fdf9085 100644 --- a/components/table/demo/ajax.vue +++ b/components/table/demo/ajax.vue @@ -79,8 +79,9 @@ type APIResult = { }[]; }; -const queryData = (params: APIParams) => { - return axios.get('https://randomuser.me/api?noinfo', { params }); +const queryData = async (params: APIParams) => { + const res = await axios.get('https://randomuser.me/api?noinfo', { params }) + return res.data.results; }; const { @@ -90,7 +91,6 @@ const { current, pageSize, } = usePagination(queryData, { - formatResult: res => res.data.results, pagination: { currentKey: 'page', pageSizeKey: 'results', diff --git a/package.json b/package.json index 7e370cdf73..2fb91f6466 100644 --- a/package.json +++ b/package.json @@ -262,7 +262,7 @@ "vue-i18n": "^9.1.7", "vue-infinite-scroll": "^2.0.2", "vue-loader": "^17.0.0", - "vue-request": "^1.0.2", + "vue-request": "^2.0.4", "vue-router": "^4.0.0", "vue-style-loader": "^4.1.2", "vue-tsc": "^1.0.6",