1.0.4 • Published 2 years ago
vben-simple-axios v1.0.4
使用
// http.ts
import { VAxios } from 'vben-simple-axios'
interface RequestOptions {}
interface Result<T = any> {}
export const http = new VAxios<RequestOptions, Result>({
transform: {
// 见axiosTransform.ts
},
requestOptions: {
// 默认的RequestOptions,可以被覆盖
},
// axios配置...
})
// api.ts
import { http } from 'http.ts'
export const testApi = (data) => {
return http.post({
url: 'xxx',
data
}, {
// RequestOptions
})
}