@pusdn/pgz-comp-elep
Version:
PGZ组件库,Vue3 中基于Element-Plus二次封装基础组件文档
80 lines (79 loc) • 2.18 kB
TypeScript
/**
* 获取Token
*/
export declare const getToken: () => string | null;
/**
* 设置Token
*/
export declare const setToken: (access_token: string) => string;
/**
* 移除Token
*/
export declare const removeToken: () => null;
/**
* 获取当前语言
*/
export declare const getLanguage: () => string;
/**
* 获取全局请求头
*/
export declare const globalHeaders: () => {
Authorization: string;
clientid: string;
};
export declare function setupHttp(options: {
baseURL?: string;
timeout?: number;
clientId?: string;
}): void;
declare let service: any;
/**
* POST请求方法
* @param url 请求地址
* @param parameter 请求参数
*/
export declare function postAction<T = any>(url: string, parameter: any): Promise<T>;
/**
* 通用HTTP请求方法
* @param url 请求地址
* @param parameter 请求参数
* @param method 请求方法
*/
export declare function httpAction<T = any>(url: string, parameter: any, method: string): Promise<T>;
/**
* PUT请求方法
* @param url 请求地址
* @param parameter 请求参数
*/
export declare function putAction<T = any>(url: string, parameter: any): Promise<T>;
/**
* GET请求方法
* @param url 请求地址
* @param parameter 请求参数
*/
export declare function getAction<T = any>(url: string, parameter: any): Promise<T>;
/**
* DELETE请求方法
* @param url 请求地址
* @param parameter 请求参数
*/
export declare function deleteAction<T = any>(url: string, parameter: any): Promise<T>;
/**
* 下载文件请求方法
* @param url 请求地址
* @param parameter 请求参数
*/
export declare function downloadFile<T = any>(url: string, parameter: any): Promise<T>;
/**
* 上传文件请求方法
* @param url 请求地址
* @param parameter 请求参数
*/
export declare function uploadFile<T = any>(url: string, parameter: any): Promise<T>;
export declare const get: typeof getAction;
export declare const post: typeof postAction;
export declare const put: typeof putAction;
export declare const del: typeof deleteAction;
export declare const download: typeof downloadFile;
export declare const upload: typeof uploadFile;
export default service;