Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

can't post the empty array #618

Open
hasbug opened this issue Jun 2, 2017 · 3 comments
Open

can't post the empty array #618

hasbug opened this issue Jun 2, 2017 · 3 comments

Comments

@hasbug
Copy link

hasbug commented Jun 2, 2017

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

@iesta
Copy link

iesta commented Nov 16, 2017

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

@rafaeldev
Copy link

Guys, try debug this part of code when post data:

for (var key in source) {

@webarthur
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants