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 +11 -3
- package/components/hy-transition/index.scss +0 -6
- package/package.json +2 -2
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
|
|
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
|
|
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
|
}
|