<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ## 1、 uni.request(OBJECT) 發起網絡請求 ``` 參數名 類型 必填 默認值 說明 url String 是 開發者服務器接口地址 data Object/String/ArrayBuffer 否 請求的參數 header Object 否 設置請求的 header,header 中不能設置 Referer。 method String 否 GET (需大寫)有效值:OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT dataType String 否 json 如果設為 json,會嘗試對返回的數據做一次 JSON.parse responseType String 否 text 設置響應的數據類型。合法值:text、arraybuffer success Function 否 收到開發者服務成功返回的回調函數 fail Function 否 接口調用失敗的回調函數 complete Function 否 接口調用結束的回調函數(調用成功、失敗都會執行) ``` **success 返回參數說明** ``` 參數 類型 說明 data Object/String/ArrayBuffer 開發者服務器返回的數據 statusCode Number 開發者服務器返回的 HTTP 狀態碼 header Object 開發者服務器返回的 HTTP Response Header ``` **data 數據說明** 最終發送給服務器的數據是 String 類型,如果傳入的 data 不是 String 類型,會被轉換成 String。轉換規則如下: ``` 對于 GET 方法,會將數據轉換為 query string。例如 { name: 'name', age: 18 } 轉換后的結果是 name=name&age=18。 對于 POST 方法且 header['content-type'] 為 application/json 的數據,會進行 JSON 序列化。 對于 POST 方法且 header['content-type'] 為 application/x-www-form-urlencoded 的數據,會將數據轉換為 query string。 ``` **示例:** ``` <template> <view></view> </template> <script> export default { data:{ }, onLoad:function(){ //get const requestTask1 = uni.request({ url: 'https://demo.hcoder.net', success: function (res) { console.log(res.data); } }); // const requestTask2 = uni.request({ url: 'https://demo.hcoder.net/index.php?m=getJson', success: function (res) { console.log(res.data); } }); // const requestTask3 = uni.request({ url: 'https://demo.hcoder.net/index.php', data: {name : 'hcoder...', 'age' : 18}, method:"POST", header : {'content-type':'application/x-www-form-urlencoded'}, success: function (res) { console.log(res.data); } }); } } </script> ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看