axios和后端交互时,参数需要写在body和query中同时写

axios.post('/api/xxx',{
// post body
},{
    params: {
        // query
    }
})

demo:

  let params = {
                      _id:this.alarmAddForm._id,
                      name:this.alarmAddForm.name,
                      userId:"user1",
                    }
                    this.$http.post('/geofence/api/geofence/updateElectricFence',this.pentagonpath,{params:params}).then((res)=>{
                    if(res.data.errcode == 0 ){
                      this.editVisible = false
                      this.load()
                    }

 

posted @ 2020-06-04 14:24  菜鸟小何  阅读(1842)  评论(0编辑  收藏  举报