2018年3月7日:
当我们使用http向后台发送请求的时候,需要通过cookie把一些密匙传递给后台做判断授权登陆,当然前提是后台会先把cookie保持到本地。
使用vue开发的时候,会出现这个问题,具体是什么原因暂时还没了解清楚,这里记录一下解决方案,作后期参考。
1 mounted(){ const self = this; axios.defaults.headers.common['BdttOneyearAct'] = "qKZ6oNCur8jc385oaaN2faK1oaiLvGOejcuqoA=="; }
在我们请求接口的时候,把cookie保存到请求的头部,从而后台能拿到这个值作判断是否登陆。
任务完成,下班!