axios设置请求头中的Authorization信息:
GET请求
this.$axios.get('/url', { headers: { 'Authorization': 'Bearer '+localStorage.getItem('token') ... }, params: { param1: string, param2: string }, ... } ) .then(res => fn) .catch(err => fn)
POST请求
axios.post(urlString, { data: data, ... }, { headers: { 'Authorization': 'Bearer ' + token ... } } ) .then(res => fn) .catch(err => fn)