//data
controller: null
//接口请求前
if (this.controller === null) {
const controller = new AbortController()
this.controller = controller
} else {
this.controller.abort()
const controller = new AbortController()
this.controller = controller
}
接口名(params, this.controller.signal).then(response => {
//接口返回数据逻辑
})
//api
export function 接口名(params, signal) {
return request({
url: '地址',
method: 'get',
params,
signal
})
}
signal前端终止请求
最新推荐文章于 2025-04-15 08:58:22 发布