uni-app 網絡請求

uni.request發起網絡請求json

url
開發者服務器接口地址服務器

data
請求的參數網絡

headerapp

method
dataTypeurl

responseType
設置響應的數據類型spa

statusCode 開發者服務器返回的http狀態碼3d

data數聽說明code

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

若本號內容有作得不到位的地方(好比:涉及版權或其餘問題),請及時聯繫咱們進行整改便可,會在第一時間進行處理。orm


請點贊!由於大家的贊同/鼓勵是我寫做的最大動力!

歡迎關注達達的簡書!

這是一個有質量,有態度的博客接口

博客

相關文章
相關標籤/搜索