因为前后端分离出现跨域的请求,域名、端口、协议不同就是跨域
1.在django中添加接受跨域请求https://www.cnblogs.com/randomlee/p/9752705.html
在前端请求的时候加上请求头 (内容类型)
axios.post(url, data,
{ headers: { 'Content-Type': 'application/x-www-form-urlencoded' ,
Authorization: "token " + this.$store.getters.getUserInfo.access_token,
} })
//在发送前编码所有字符(默认)
后续出现参数没有序列化的问题,难以提取数据,加入qs模块
https://www.cnblogs.com/dreamzone/p/13081082.html
let data = QS.stringify({
id: this.$route.query.id,
gpu: this.gpu,
width: screen.width,
height: screen.height
// urlid:this.$route.query.urlid,
});