Skip to content

Commit d76dc42

Browse files
committed
style(alova): 💄 修改第三方接口
1 parent cedd21e commit d76dc42

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

.env.development

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
VITE_HASH_ROUTE=false
33

44
# 后端开发环境接口访问地址
5-
VITE_BASIC_API_URL="http://t.weather.sojson.com"
5+
VITE_BASIC_API_URL="https://jsonplaceholder.typicode.com"

src/pages/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
const { loading, data, send: sendRequest } = useRequest(alova.Get('/api/weather/city/101030100'), { immediate: false })
2+
const { loading, data, send: sendRequest } = useRequest(alova.Get('/posts'), { immediate: false })
33
const handlerEvent = async (): Promise<void> => {
44
await sendRequest()
55
}

src/utils/alova.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const alova = createAlova({
66
//alova实例id,多个实例必须唯一
77
id: 'default',
88
//统一请求基础路径
9-
baseURL: '',
9+
baseURL: import.meta.env.VITE_BASIC_API_URL,
1010
//请求超时时间,默认不超时
1111
timeout: 10000,
1212
//状态管理钩子,VueHook用于创建ref状态,包括请求状态loading、响应数据data、请求错误对象error等

0 commit comments

Comments
 (0)