diff --git a/src/pages/about/components/request-openapi.vue b/src/pages/about/components/request-openapi.vue index 821ad6b..9ce6bae 100644 --- a/src/pages/about/components/request-openapi.vue +++ b/src/pages/about/components/request-openapi.vue @@ -1,6 +1,6 @@ @@ -46,16 +46,19 @@ const { data: data2, loading: loading2, run } = useRequest(() => infoUsingGet({} 2)直接使用 openapi + useRequest 生成的请求 - + - - 请求数据如下 - - - {{ JSON.stringify(data2) }} - + + + + 请求数据如下 + + + {{ JSON.stringify(data2) }} diff --git a/src/service/listAll.ts b/src/service/listAll.ts index bcbd21b..2caddd9 100644 --- a/src/service/listAll.ts +++ b/src/service/listAll.ts @@ -4,6 +4,7 @@ import request from '@/http/vue-query'; import { CustomRequestOptions } from '@/http/types'; import * as API from './types'; +const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)); /** 用户列表 GET /user/listAll */ export async function listAllUsingGet({ @@ -11,6 +12,7 @@ export async function listAllUsingGet({ }: { options?: CustomRequestOptions; }) { + await sleep(2000); // 方便测试 cancel 功能 return request('/user/listAll', { method: 'GET', ...(options || {}),