获得徽章 20
- /** 文章分页 */
getArticlePage(query: Record<string, any>, id: number) {
return request<IArticleResponseItem[]>(`${this.prefix}/page`, {
params: query,
})
}
export function withCancelToken<T, K>(fetcher: (...args: T[]) => K) {
let controller: AbortController;
function send(...args: T[]) {
cancel();
controller = new AbortController();
return fetcher(...args)
}
function cancel() {
if (controller) {
controller.abort();
}
}
return [send, cancel];
}
const [fetchListData, cancelList] = withCancelToken(contentService.getArticlePage)
这种要怎么定义呀展开评论点赞
![[晕]](http://lf-web-assets.juejin.cn/obj/juejin-web/xitu_juejin_web/img/jj_emoji_33.12a8e53.png)