vue axios


axios 使用post传参

1.后台接收JavaBean格式

方法一:let adminInfo=JSON.parse(JSON.stringify(list));//需要转成json对象             http({               url: '/dic-code/edit',               method: 'post',               headers:{                 ContentType: 'application/json;charset=UTF-8'  //这里加上头部信息               },               data:adminInfo,             }).then(res => {             }) 方法二: http.post('/dic-code/save',           adminInfo,           {             headers:{               'Content-Type': 'application/json;charset=UTF-8'  //这里加上头部信息             }           }           ).then(res => {             this.getMenu();           }) 2.后台只接受一个字符串 http({               url: '/dic-code/del',               method: 'post',               headers:{                 ContentType: 'application/json;charset=UTF-8'  //这里加上头部信息               },               params:{id:this.treeId},             }).then(res => {               console.log(res);               this.getMenu();             })
vue