Movatterモバイル変換


[0]ホーム

URL:


codecamp

响应结构

某个请求的响应包含以下信息

{    // data 由服务器提供的响应    data: {},        // status 来自服务器响应的 HTTP 状态码    status: 200,    // statusText 来自服务器响应的 HTTP 状态信息    statusText: 'OK',    // headers 服务器响应的头    headers: {},    // config 是为请求提供的配置信息    config: {},    // request 是生成当前响应的请求    // 在 node.js 中是最后一个 ClientRequest 实例 (在重定向中)    // 在浏览器中是 XMLHttpRequest 实例    request: {}}

使用 then 时,你将接收下面这样的响应 :

axios.get('/user/12345')    .then(function (response) {        console.log(response.data);        console.log(response.status);        console.log(response.statusText);        console.log(response.headers);        console.log(response.config);    })

在使用 catch 、或传递 rejection callback 作为 then 的第二个参数时,响应可以通过 error 对象被使用,可参考后面的篇章 —— 错误处理。

请求配置
配置默认值
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

无标题目录

无标题目录

无标题目录

关闭

MIP.setData({'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false},'pageFontSize' : getCookie('pageFontSize') || 20});MIP.watch('pageTheme', function(newValue){setCookie('pageTheme', JSON.stringify(newValue))});MIP.watch('pageFontSize', function(newValue){setCookie('pageFontSize', newValue)});function setCookie(name, value){var days = 1;var exp = new Date();exp.setTime(exp.getTime() + days*24*60*60*1000);document.cookie = name + '=' + value + ';expires=' + exp.toUTCString();}function getCookie(name){var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)');return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null;}
[8]ページ先頭

©2009-2025 Movatter.jp