UNPKG

ez-axios

Version:
71 lines (62 loc) 3.01 kB
import { AxiosResponse } from 'axios'; /** * ez-axios 全局配置 * @param options */ declare const _default: (options: ezAxiosOptions) => void; export default _default; /** * @description del 方法,对应 delete 请求 * @param { String } url 接口地址 * @param { Record<string, string> | Array } params [请求参数]:只能作为第二个参数 * @param { String } requestType [请求参数类型]:json(默认)、query * @param { ezAxiosOptions } customOptions [自定义设置]:不可作为前两个参数,会覆盖全局配置 * @returns delete 请求的 Promise 处理 */ export declare function del(url: string, ...theArgs: any[]): Promise<any>; export declare interface ezAxiosOptions { timeout?: number; briefly?: boolean; baseURL?: string; mark?: string | Array<string>; loading?: boolean; headers?: Record<string, string>; error?: (status: number) => void; success?: (response: AxiosResponse) => void; } /** * @description get 方法,对应 get 请求 * @param { String } url 接口地址 * @param { Record<string, string> | Array } params [请求参数]:只能作为第二个参数 * @param { String } responseType [返回值类型]:(多用于下载)blob * @param { ezAxiosOptions } customOptions [自定义设置]:不可作为前两个参数,会覆盖全局配置 * @returns get 请求的 Promise 处理 */ export declare function get(url: string, ...theArgs: any[]): Promise<any>; export declare class Loading { private static loadingDom; constructor(); static show(opacity?: number, zIndex?: number): void; static close(): void; } /** * @description post 方法,对应 post 请求 * @param { String } url 接口地址 * @param { Record<string, string> | Array | File } params [请求参数]:只能作为第二个参数 * @param { String } requestType [请求参数类型]:json(默认)、query、file、data * @param { String } responseType [返回值类型]:(多用于下载)blob,请参数类型为query时失效 * @param { ezAxiosOptions } customOptions [自定义设置]:不可作为前两个参数,会覆盖全局配置 * @returns post 请求的 Promise 处理 */ export declare function post(url: string, ...theArgs: any[]): Promise<any>; /** * @description put 方法,对应 put 请求 * @param { String } url 接口地址 * @param { Record<string, string> | Array | File } params [请求参数]:只能作为第二个参数 * @param { String } requestType [请求参数类型]:json(默认)、query、file、data * @param { String } responseType [返回值类型]:(多用于下载)blob,请参数类型为query时失效 * @param { ezAxiosOptions } customOptions [自定义设置]:不可作为前两个参数,会覆盖全局配置 * @returns put 请求的 Promise 处理 */ export declare function put(url: string, ...theArgs: any[]): Promise<any>; export { }