vue-resource icon indicating copy to clipboard operation
vue-resource copied to clipboard

can't post the empty array

Open hasbug opened this issue 7 years ago • 3 comments

this code lost the empty array(tags:[])。just post the { id:1, isMain:true }

data () {
	return {
  	form: {
    	tags[],
      id:1,
      isMain:true
    }
  }
}

methods: {
	 update () {  //update
   
     console.log(this.form) // { tags[], id:1, isMain:true }

     //{ id:1, isMain:true }
     this.$http.post('/operator/update', this.form).then((response) => {
       // success
       const res = response.body;
       if (res.code==200) {
         if(res.data.success){
           this.$message(res.msg);
         }else{
           this.$message.error(res.data.message);
         }
       } else {
         this.$message.error(res.msg);
       }
     }, (response) => {
       // error
       this.$message('error:' + response);
     });
   },
}

chrome 58.0.3029.110 vue2.x

hasbug avatar Jun 02 '17 14:06 hasbug

I have the same problem. Is it the intended behavior ?

iesta avatar Nov 16 '17 14:11 iesta

Guys, try debug this part of code when post data: https://github.com/pagekit/vue-resource/blob/60c1b71b17a958b3f035ae22ff045d34f2fe5878/dist/vue-resource.js#L439

rafaeldev avatar Dec 02 '17 01:12 rafaeldev

I think it is a request issue:

https://stackoverflow.com/questions/9397669/jquery-ajax-jsonp-how-to-actually-send-an-array-even-if-its-empty

webarthur avatar Mar 14 '18 21:03 webarthur