小编这次要给大家分享的是Vue怎么请求传公共参数,文章内容丰富,感兴趣的小伙伴可以来了解一下,希望大家阅读完这篇文章之后能够有所收获。
我就废话不多说了,大家还是直接看代码吧~
// An highlighted block //http request拦截器 axios.interceptors.request.use( config =>{ const token = window.sessionStorage.getItem('Tk_token') const user_id=window.sessionStorage.getItem('Tk_user_id') // config.data = JSON.stringify(config.data); // config.headers = { // 'Content-Type':'application/x-www-form-urlencoded' // } if(token){ config.params = {'token':token,'user_id':user_id} } console.log(config); return config; }, err =>{ return Promise.reject(err); } )