Files
vue-frame/src/services/home.ts
2024-12-03 13:56:17 +08:00

27 lines
625 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import Axios from '@/api/base-service' // 导入配置好的axios文件
// 封装axios请求函数并用export导出
// get请求
const getInfo = (params: unknown) => {
return Axios({
url: '/api/horoscope',
method: 'get',
headers: {
'Content-Type': 'application/x-www-form-urlencoded' //设置请求头请求格式form
},
params
})
}
// post请求
const getItem = (data: unknown) => {
return Axios({
url: '/api/getItem',
method: 'post',
headers: {
'Content-Type': 'application/json' //设置请求头请求格式为json
},
data
})
}
export { getInfo, getItem }