Explorar el Código

chore: 类型文件统一加前缀 I

菲鸽 hace 2 años
padre
commit
1b7ae81550
Se han modificado 3 ficheros con 8 adiciones y 8 borrados
  1. 3 3
      src/pages/index/request.vue
  2. 1 1
      src/service/foo.d.ts
  3. 4 4
      src/service/foo.ts

+ 3 - 3
src/pages/index/request.vue

@@ -32,7 +32,7 @@
 </template>
 
 <script lang="ts" setup>
-import { getFoo, postFoo, FooItem } from '@/service/foo'
+import { getFoo, postFoo, IFooItem } from '@/service/foo'
 
 const recommendUrl = ref('http://laf.run/signup?code=ohaOgIX')
 
@@ -41,13 +41,13 @@ onLoad(() => {
   testRequest2()
 })
 
-const data = ref<FooItem>()
+const data = ref<IFooItem>()
 const testRequest = async () => {
   const res = await getFoo('菲鸽')
   data.value = res.result
 }
 
-const data2 = ref<FooItem>()
+const data2 = ref<IFooItem>()
 const testRequest2 = async () => {
   const res = await postFoo('菲鸽2')
   data2.value = res.result

+ 1 - 1
src/service/foo.d.ts

@@ -1,4 +1,4 @@
-export type FooItem = {
+export type IFooItem = {
   id: string
   name: string
 }

+ 4 - 4
src/service/foo.ts

@@ -1,11 +1,11 @@
 import { http } from '@/utils/http'
-import type { FooItem } from './foo.d'
+import type { IFooItem } from './foo.d'
 
-export { FooItem }
+export { IFooItem }
 
 /** get 请求 */
 export const getFoo = (name: string) => {
-  return http<FooItem>({
+  return http<IFooItem>({
     url: `/foo`,
     method: 'GET',
     query: { name },
@@ -14,7 +14,7 @@ export const getFoo = (name: string) => {
 
 /** get 请求 */
 export const postFoo = (name: string) => {
-  return http<FooItem>({
+  return http<IFooItem>({
     url: `/foo`,
     method: 'POST',
     query: { name }, // post 请求也支持 query