调用this.controller.abort()时没反应,代码如下
//api.js
async function zhinenghegao(fileName, filePath, meetingId, signal) {
return await https.get(
`/meeting-service/file/check?fileName=${fileName}&filePath=${filePath}&meetingId=${meetingId}`,
{
signal:signal
}
);
}
//.vue
data(){
return {
controller:new AbortController()
}
},
methods:{
async hegao() {
try {
let res = await api.meeting.zhinenghegao(
file.name,
file.url,
this.meetingId,
this.controller.signal
);
} catch (e) {
}
},
hegaoCancel() {
this.$Modal.confirm({
title: "提醒",
content: "",
okText: "确认",
onOk: () => {
console.log(this.controller.abort)
this.controller.abort()
},
onCancel: () => {}
});
},
}
看下https的封装呢