注意格式
element admin temp
在utils > request改成
import Cookies from 'js-cookie' service.interceptors.request.use( config => { let thisTocken = Cookies.get("vue_admin_template_token"); if (thisTocken) { config.headers['authorization'] = "Bearer " + thisTocken } return config }, error => { console.log("request.use" + error) return Promise.reject(error) } )
token 的值 在
store > modules >user.js 的login 登录成功获取token 存入cookie
标签:401,thisTocken,jwt,request,element,token,tocken,error,config From: https://www.cnblogs.com/hkzw/p/16594635.html