RequestTask
Introduction
Network request task object
Methods
- Abort request task RequestTask.abort()
Sample Code
// pages/index/index.js
Page({
request() {
const requestTask = dlt.request({
url: "xxx",
data: JSON.stringify({ x: "xx" }),
header: JSON.stringify({
"content-type": "application/json",
}),
success(res) {
console.log(res);
},
fail(res) {
console.error(res);
},
});
requestTask.abort(); // Cancel request task
},
});