HomeDocs
跳到主要内容

RequestTask

简介

网络请求任务对象

方法

示例代码

// 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(); // 取消请求任务
},
});
Privacy agreementDeveloper agreementcontact us: developer_service.mi@transsion.com © 2024 MiniApp. All Rights Reserved.