http.get>("/test", params);
或
http.get>("/test", params);
TS 有没有什么办法传入一个参数或怎样实现自动识别调用分页和不分页的类型?
get(url: string, params?: object, _object = {}): Promise {
return this.service.get(url, { params, ..._object });
}
// 请求响应
export interface Result {
code: string;
message: string;
}
// 请求响应数据
export interface ResultData extends Result {
data: T;
}
// 请求分页响应
export interface ResultPage extends Result {
count: number;
current: number;
limit: number;
data: T[];
}
resultdata, params, resultpage, string