Home >Web Front-end >JS Tutorial >Detailed explanation of the steps for setting header information in vue-resource interceptor

Detailed explanation of the steps for setting header information in vue-resource interceptor

php中世界最好的语言
php中世界最好的语言Original
2018-04-16 14:00:382500browse

This time I bring to you what are the precautions. The following is a practical case, let’s take a look.

Use vue-resource, set the header information:

Vue.http.interceptors.push((request, next) => {
 request.headers.set('Authorization', token)
 console.log(request.headers)
 next(response => {
  console.log(response.status)
  return response
 })
})

I believe you have read the case in this article After mastering the method, please pay attention to other related articles on the php Chinese website for more exciting content!

Recommended reading:

Implementing ajax sending asynchronous request method

Detailed explanation of the dynamic use of v-model in vue

el-uploadHow to upload Excel files


The above is the detailed content of Detailed explanation of the steps for setting header information in vue-resource interceptor. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn