hy-app 0.3.12 → 0.3.13

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/api/http.ts CHANGED
@@ -70,7 +70,7 @@ export default class Http {
70
70
  * @description uni异步请求
71
71
  * @param options 请求配置
72
72
  */
73
- async request(options: UniNamespace.RequestOptions) {
73
+ async request<T = any>(options: UniNamespace.RequestOptions): Promise<T> {
74
74
  options.url = this.config.baseURL + options.url || this.config.url;
75
75
  options.data = options.data || this.config.data;
76
76
  options.header = options.header || this.config.header;
@@ -104,7 +104,11 @@ export default class Http {
104
104
  * @param params 请求JSON参数
105
105
  * @param options 请求配置
106
106
  */
107
- post(url: string, params?: any, options?: HttpRequestConfig) {
107
+ post<T = any>(
108
+ url: string,
109
+ params?: any,
110
+ options?: HttpRequestConfig,
111
+ ): Promise<T> {
108
112
  return this.request({
109
113
  url: url,
110
114
  method: "POST",
@@ -119,7 +123,11 @@ export default class Http {
119
123
  * @param params URL查询参数
120
124
  * @param options 请求配置
121
125
  */
122
- get(url: string, params?: any, options?: HttpRequestConfig) {
126
+ get<T = any>(
127
+ url: string,
128
+ params?: any,
129
+ options?: HttpRequestConfig,
130
+ ): Promise<T> {
123
131
  if (params) {
124
132
  url += "?" + objectToUrlParams(params);
125
133
  }
@@ -111,9 +111,3 @@ $u-zoom-scale: scale(0.95);
111
111
  .u-zoom-leave-to {
112
112
  transform: $u-zoom-scale
113
113
  }
114
-
115
- @include b(transition) {
116
- display: flex;
117
- justify-content: center;
118
- align-items: center;
119
- }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hy-app",
3
- "version": "0.3.12",
4
- "description": "http网络请求修复",
3
+ "version": "0.3.13",
4
+ "description": "拦截器get和post加类型判断",
5
5
  "main": "./index.ts",
6
6
  "private": false,
7
7
  "scripts": {},