vue-axios中的delete data报错
post 请求这样写正常请求:
methods: {
      createnode(){
            //执行测试任务
            console.log('获取当前vue的所有数据:')
            console.log(this)
            var get_data = this.$data
            console.log(get_data)
            var vue_data_url = this.globalHttpUrl + ':8666/create_new_node'
            axios.post(vue_data_url, JSON.stringify(get_data),{
                headers: {
                    'Content-Type': 'application/json'}
                })
            .then(response =>{
        
                console.log(response)
                alert('创建成功,返回测试任务列表查看节点信息')
            }
            )
        }
    }
  }
但是delete这样写请求异常了:
methods: {
      createnode(){
            //执行测试任务
            console.log('获取当前vue的所有数据:')
            console.log(this)
            var get_data = this.$data
            console.log(get_data)
            var vue_data_url = this.globalHttpUrl + ':8666/create_new_node'
            axios.delete(vue_data_url, JSON.stringify(get_data),{
                headers: {
                    'Content-Type': 'application/json'}
                })
            .then(response =>{
        
                console.log(response)
                alert('创建成功,返回测试任务列表查看节点信息')
            }
            )
        }
    }
  }
delete请求需要这样写:
 deletenodefun(){
            //执行测试任务
            console.log('获取当前vue的所有数据:')
            console.log(this)
            var get_data = this.$data
            console.log(get_data)
            console.log(JSON.stringify(get_data))
            var vue_data_url = this.globalHttpUrl + ':8666/delete_node'
            axios.delete(vue_data_url, {
                headers:{'Content-Type': 'application/json'},
                data:JSON.stringify(get_data)
            })
            .then(response =>{
                console.log(response)
                alert('删除成功请返回到“测试任务”页面查看')
            }
            )
        }
       
    }
在axios官网也能看到一些信息:


 
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号