Skip to content

Commit 2afa184

Browse files
author
kevin
committed
feat: add test api
1 parent 2fa1343 commit 2afa184

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

.env.development

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VITE_API_BASE_URL=''
1+
VITE_API_BASE_URL=https://res.abeim.cn

.env.production

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VITE_API_BASE_URL=http://github.com/api
1+
VITE_API_BASE_URL=https://res.abeim.cn

src/api/manager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import service from './service'
22

33
export const get = (url, params) => {
4-
return service.requese({ url: url, params: params, method: 'GET' })
4+
return service.request({ url: url, params: params, method: 'GET' })
55
}
66

77
export const post = (url, data) => {

src/api/user.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { post, get } from './manager'
1+
import { get } from './manager'
22

3-
export const info = (params) => get('/user/info', params)
4-
export const login = (data) => post('/user/login', data)
3+
export const text = (params) => {
4+
return get('/api-text_yiyan', params)
5+
}

src/pages/Home.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
<template>
2-
<div class="w-screen h-screen bg-amber-600">Home</div>
2+
<div class="w-screen h-screen flex justify-center items-center bg-amber-600">
3+
<div v-if="userInfo">
4+
<p class="font-mono text-white text-2xl">{{ userInfo.content }}</p>
5+
</div>
6+
</div>
37
</template>
48

59
<script>
610
import { ref, onBeforeMount } from 'vue'
7-
import { info } from '../api/user'
11+
import { text } from '../api/user'
812
913
export default {
1014
setup() {
1115
const userInfo = ref(null)
1216
onBeforeMount(async () => {
13-
const res = await info({ id: 1 })
17+
const res = await text({ export: 'json' })
1418
userInfo.value = res
1519
})
1620
return {

0 commit comments

Comments
 (0)