关于axios如何在请求头添加参数

vm.$http.post(apiUrl.refundOrder, data,{
    headers:{
        'lz-shopid':vm.orderRecords.shopId
    }
}).then(res => {
    if(res.code==1){
        vm.$toast.center(res.message)
    }
}).catch(error => {
    
})
export function fetch(url, params = {},headers) {
  return new Promise((resolve, reject) => {
    axios.get(url, {
        params: params,
        headers:headers.headers
      })
      .then(response => {
        resolve(response.data);
      })
      .catch(err => {
        reject(err)
      })
  })
}

  

原文地址:https://www.cnblogs.com/ruthless/p/9837353.html