feat(useRequest): 请求取消功能,有效避免内存泄漏和不必要的资源消耗,尤其适用于长时间运行的请求或组件卸载场景。

This commit is contained in:
liaochunxin
2025-09-23 09:58:25 +08:00
parent 674ea563f2
commit 7923aa7423
4 changed files with 55 additions and 17 deletions

View File

@@ -7,6 +7,11 @@ export type CustomRequestOptions = UniApp.RequestOptions & {
hideErrorToast?: boolean
} & IUniUploadFileOptions // 添加uni.uploadFile参数类型
export interface HttpRequestResult<T> {
promise: Promise<T>
requestTask: UniApp.RequestTask
}
// 通用响应格式
export interface IResponse<T = any> {
code: number | string