赞
踩
巨坑,vue用的不熟练真的巨坑,
Get请求:
- Vue.http.get('http://localhost:9090/card-add',{
- params:{id:1,name:'aaa'}....->get请求必须加params
- })
- .then(
- (response)=>{
- //-响应成功回调
- console.log(response.data)
- },
- (response)=>{
- //-响应错误回调
- });
浏览器正确情况:
Post请求:
- Vue.http.post('http://localhost:9090/st-add',{
- stName:"jxh",//st.stName,
- idCard:st.idCard,
- sex:st.sex,
- school:st.school,
- depict:st.depict,
- birthday:'2019/11/11',//st.birthday,
- clubs:st.clubs
- },{
- emulateJSON: true -->这一段必须存在!
- })
- .then(
- (response)=>{
- //-响应成功回调
- console.log(response.data)
- },
- (response)=>{
- //-响应错误回调
- });
post错误情况,浏览器状况:
这种错误情况,请和上面比对,你虽然能看到全部的请求参数,但结果就是404.
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。