data(){
return{
cancel:''
}
methods:{
cancelRequest(){
if(typeof this.cancel ==='function'){
this.cancel('终止请求')
}
},
}
getOrderList(){
this.cancelRequest
await getOrderList(params,this)
}
api中:
export function getOrderList(data,self) {
return request({
url: `${teacherPath}/sys/order/v1/getOperatorOrderV2`,
method: "get",
params: data,
cancelToken: new axios.CancelToken (function executor(c) {
self.cancel = c
})
});