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中世界最好的语言
Release: 2018-04-16 14:00:38
Original
2511 people have browsed it

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
 })
})
Copy after login

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!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template