chore: 类型文件统一加前缀 I
This commit is contained in:
parent
ff2eee6613
commit
1b7ae81550
@ -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
|
||||
|
2
src/service/foo.d.ts
vendored
2
src/service/foo.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
export type FooItem = {
|
||||
export type IFooItem = {
|
||||
id: string
|
||||
name: string
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user