@moluoxixi/ajax-package 0.0.17 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/BaseHttpClient.d.ts +111 -0
- package/es/SystemErrorDialog.d.ts +4 -0
- package/es/_types/api.d.ts +38 -0
- package/es/_types/emits.d.ts +7 -0
- package/es/_types/props.d.ts +14 -0
- package/es/_utils/messageWrapper.d.ts +4 -0
- package/es/_utils/notificationWrapper.d.ts +4 -0
- package/es/_utils/systemErrorInfo.d.ts +21 -0
- package/es/class.d.ts +198 -11
- package/es/index.mjs +445 -114
- package/es/netseriver.d.ts +14 -0
- package/package.json +1 -1
- package/es/test/service.d.ts +0 -40
package/es/netseriver.d.ts
CHANGED
|
@@ -5,8 +5,22 @@ declare global {
|
|
|
5
5
|
$http?: vueHttpServiceType;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* 创建 HTTP 服务实例
|
|
10
|
+
* @param options - API 配置对象
|
|
11
|
+
* @returns BaseApi 实例
|
|
12
|
+
*/
|
|
8
13
|
declare function createHttpService(options?: BaseApiConfig): BaseApi;
|
|
14
|
+
/**
|
|
15
|
+
* Vue Axios 插件,用于在 Vue 应用中全局注册 HTTP 服务
|
|
16
|
+
* 提供 this.$http、inject('$http') 和 window.$http 三种使用方式
|
|
17
|
+
*/
|
|
9
18
|
declare const VueAxiosPlugin: vueAxiosPluginType;
|
|
19
|
+
/**
|
|
20
|
+
* 获取 HTTP 服务实例,与 createHttpService 功能相同
|
|
21
|
+
* @param options - API 配置对象
|
|
22
|
+
* @returns BaseApi 实例
|
|
23
|
+
*/
|
|
10
24
|
declare function getHttpService(options?: BaseApiConfig): BaseApi;
|
|
11
25
|
export default VueAxiosPlugin;
|
|
12
26
|
export { createHttpService, getHttpService };
|
package/package.json
CHANGED
package/es/test/service.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export default service;
|
|
2
|
-
/**
|
|
3
|
-
* 创建 axios 实例
|
|
4
|
-
* @type {NewApi}
|
|
5
|
-
*/
|
|
6
|
-
declare const service: NewApi;
|
|
7
|
-
/**
|
|
8
|
-
* 自定义 API 类,继承自 BaseApi
|
|
9
|
-
* 实现了原有的 axios 封装功能
|
|
10
|
-
*/
|
|
11
|
-
export class NewApi {
|
|
12
|
-
constructor(config?: {});
|
|
13
|
-
/**
|
|
14
|
-
* 处理请求配置
|
|
15
|
-
* 在请求发送之前进行一些处理
|
|
16
|
-
* 对应旧代码的请求拦截器逻辑
|
|
17
|
-
*/
|
|
18
|
-
processRequestConfig(config: any): any;
|
|
19
|
-
/**
|
|
20
|
-
* 处理 HTTP 状态码
|
|
21
|
-
*/
|
|
22
|
-
handleHttpStatus(response: any): void;
|
|
23
|
-
/**
|
|
24
|
-
* 处理业务错误(重写父类方法,不抛出错误,只显示消息)
|
|
25
|
-
*/
|
|
26
|
-
handleBusinessError(code: any, message: any): void;
|
|
27
|
-
/**
|
|
28
|
-
* 处理成功响应(完全重写,符合旧代码逻辑)
|
|
29
|
-
*/
|
|
30
|
-
handleSuccessResponse(response: any): any;
|
|
31
|
-
/**
|
|
32
|
-
* 处理超时错误(重写父类方法)
|
|
33
|
-
*/
|
|
34
|
-
handleTimeoutError(error: any): void;
|
|
35
|
-
/**
|
|
36
|
-
* 处理网络错误(重写父类方法)
|
|
37
|
-
*/
|
|
38
|
-
handleNetworkError(error: any): void;
|
|
39
|
-
}
|
|
40
|
-
export function showErrorNotification(title: any, errors: any): void;
|