美文网首页编程技术
axios设置header信息

axios设置header信息

作者: robotlee8 | 来源:发表于2017-12-08 00:15 被阅读19225次

以下方法是在vue-cli 中使用,this指vue

    this.axios.post(`${API_HOST}/api/auth/login`, obj, {
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    }).then(function(response) {
        const data = response.data;
    }, function(response) {});
    this.axios({
        method: "POST",
        url: `${API_HOST}/api/bind/index`,
        data: obj,
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    }).then(function(res) {
        console.log(res);
    });

相关文章

网友评论

    本文标题:axios设置header信息

    本文链接:https://www.haomeiwen.com/subject/umijbxtx.html