diff --git a/src/api/alova-foo.ts b/src/api/foo-alova.ts similarity index 100% rename from src/api/alova-foo.ts rename to src/api/foo-alova.ts diff --git a/src/api/foo.ts b/src/api/foo.ts new file mode 100644 index 0000000..51a1905 --- /dev/null +++ b/src/api/foo.ts @@ -0,0 +1,16 @@ +import { http } from '@/http/http' + +export interface IFoo { + id: number + name: string +} + +export function foo() { + return http.Get('/foo', { + params: { + name: '菲鸽', + page: 1, + pageSize: 10, + }, + }) +} diff --git a/src/http/http.ts b/src/http/http.ts index edf510d..5cea939 100644 --- a/src/http/http.ts +++ b/src/http/http.ts @@ -110,3 +110,9 @@ http.get = httpGet http.post = httpPost http.put = httpPut http.delete = httpDelete + +// 支持与 alovaJS 类似的API调用 +http.Get = httpGet +http.Post = httpPost +http.Put = httpPut +http.Delete = httpDelete diff --git a/src/pages/about/alova.vue b/src/pages/about/alova.vue index 4123b22..d105747 100644 --- a/src/pages/about/alova.vue +++ b/src/pages/about/alova.vue @@ -9,7 +9,7 @@