uni.request发起网络请求

url
开发者服务器接口地址

data
请求的参数

header

method
dataType

responseType
设置响应的数据类型

statusCode 开发者服务器返回的http状态码

data数据说明

<template>  <view></view></template>
// get const requestTask1 = uni.request({ url: ' ', success: function(res) {  console.log(res.data); }});//const requestTask2 = uni.request({ url :'' data:{}, method: 'POST', header: {'content-type': 'application/x-www-form-urlencoded'}, success: function(res){ }

header['content-type'] 为 application/json 的数据,会进行 JSON 序列化

若本号内容有做得不到位的地方(比如:涉及版权或其他问题),请及时联系我们进行整改即可,会在第一时间进行处理。


请点赞!因为你们的赞同/鼓励是我写作的最大动力!

欢迎关注达达的简书!

这是一个有质量,有态度的博客