uni-app 网络请求

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/qq_36232611/article/details/102536714

uni.request发起网络请求

url开发者服务器接口地址

data请求的参数

header

methoddataType

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 序列化

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

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

欢迎关注达达的简书!

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

博客

猜你喜欢

转载自blog.csdn.net/qq_36232611/article/details/102536714