当前位置:首页 > 数据库 > 正文

axios get,post请求时带headers

2020-02-12 数据库

axios post请求时带headers:

    axios.post("http://xxx.com/xxx/xxx/xxx?", { ‘queslistid‘: this.kemuid }, { headers: { ‘token‘: Cookies.get(‘token‘), ‘platform‘: ‘web‘ } }
    ).then((login) => {
      console.log(login)
    });

  

axios get请求时带headers:

    axios.get("http://xxx.com/xxx/?", { params: { id: this.kemuid }, headers: { token: Cookies.get(‘token‘), platform: ‘web‘ } }
    ).then((res) => {
      console.log(res);
    });

  

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/SQL/15255.html