mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-06 15:15:07 +08:00
feat: vue3 axios add download function
This commit is contained in:
@ -37,12 +37,17 @@ async function putFn<T = any>(option: AxiosConfig): Promise<T> {
|
||||
const res = await request({ method: 'PUT', ...option })
|
||||
return res.data
|
||||
}
|
||||
async function downloadFn<T = any>(option: AxiosConfig): Promise<T> {
|
||||
const res = await request({ method: 'GET', responseType: 'blob', ...option })
|
||||
return res as unknown as Promise<T>
|
||||
}
|
||||
|
||||
export const useAxios = () => {
|
||||
return {
|
||||
get: getFn,
|
||||
post: postFn,
|
||||
delete: deleteFn,
|
||||
put: putFn
|
||||
put: putFn,
|
||||
download: downloadFn
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user