前端没有用vue脚手架开发,不太熟
前端请求代码:
findALl() {
axios.get("http://localhost:9090/blog/findAll",
// {async:true},
//
// {crossDomain:true},
{headers: {token:'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwYXNzd29yZCI6IjAxNDRjYzU5NTcyMDY2OTYyMDIxNWQwMjljZWMwNDZlIiwiZXhwIjoxNjIwMjY1OTYxLCJ1c2VybmFtZSI6ImFkbWluIn0.xCPFVgHoUzrl8b2ZaU6CJeFin9iqadSCnWQaCUwpP5o'}},
).then(res => {
console.log(JSON.parse(JSON.stringify(res.data)));
// this.tableData = res.data;
})
},
后端一直取不到headers里的token信息
明明再postman里面测试的时候可以接收到,不太懂,有没有大佬指点一下
可以阿
没看到浏览器提示跨域吗!?!??!?!
return axios.get(url, {
params: data,
headers: {'yl-authorization': this.token}//设置header信息
}).then((res) => {
this.plList = res.data;
if (this.plList.length < this.size) {
this.jiazai = '没有更多数据啦~~~'
}else {
this.jiazai = '点击加载更多'
}
})
前端接口请求的是这个地址吗 http://localhost:9090/blog/findAlI localhost代表的是本地主机 其他电脑访问这个地址是访问不了你的接口地址的 换成IP地址试试