const params = new URLSearchParams();//前端在传参时需要先新建一个URLSearchParams对象,然后将参数append到这个对象中
params.append('data',JSON.stringify(this.addPlanRoute))//几个参数就append几次,对应格式append('参数名',参数值)
params.append('year',2019)
axios({
method:"post",
url:"http://localhost:8080/ceshi",
headers: {"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" },//设置提交表头'application/x-www-form-urlencoded; charset=UTF-8'数据格式
withCredentials:true,
data: params //将params对象传递到接口参数
}).then((res)=>{ console.log(res); });//打印返回结果