diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 4c224d1..bec1d32 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -7,7 +7,7 @@ - + Demo Count: {{ countStore.count }} @@ -28,6 +28,7 @@ import { ref } from 'vue' import { useCountStore, useUserStore } from '@/store' import { http } from '@/utils/http' +import { UserItem } from '@/typings' const countStore = useCountStore() const title = ref('Hello') @@ -43,8 +44,8 @@ const setUserInfo = () => { const clearUserInfo = () => { userStore.clearUserInfo() } -const request = () => { - const res = http({ +const handleRequest = () => { + const res = http({ url: '/getUserList', method: 'GET', }) diff --git a/src/typings.d.ts b/src/typings.d.ts index c8b35b5..ad584c7 100644 --- a/src/typings.d.ts +++ b/src/typings.d.ts @@ -2,3 +2,7 @@ export type UserInfo = { username: string token: string } +export type UserItem = { + username: string + age: number +}