How to delete the uninput worthwhile part of vue.js

how to send only the input to the backend. At this stage, three input boxes have been written, and only two of them may be entered in actual use, but now because they are all written to death, the contents of three boxes will be sent every time, even if they are empty. I don"t know how to send selectively, that is, only get the json with input value.
my data section:

testData:{
    "name" :"test",    
    "mylists":[
        {
            "user_ids":"",
            "group":""
        },
        {
            "user_ids":"",
            "group":""
        },
         {
            "user_ids":"",
            "group":""
        }
      
    ]
    
}

submit Code:

submit(event){
        event.preventDefault();
       
        let formData = new FormData();
        let testData = JSON.stringify(this.testData);
        formData.append("testData", testData);
  
        axios.post("/", formData
          ,config
          ....

for example, enter only the first two, but get:

{
    "name" :"test",    
    "mylists":[
        {
            "user_ids":"1",
            "group":"1"
        },
        {
            "user_ids":"1",
            "group":"1"
        },
         {
            "user_ids":"",
            "group":""
        }
      
    ]
    
}

in this case, how can the third row with no value not be displayed?

Mar.09,2021

use computed to calculate properties


try this

testData
.replace(',{"user_ids":"","group":""}','')
.replace('{"user_ids":"","group":""},','')

it's better this way

let testData = {}    
for(let i =0 ; i<this.testData.length ; iPP){
    let t = this.testData[i]
    if(!t["user_ids"]&&!t["group"]){
        testData.push(t)
    }
}
let json = JSON.stringify(testData)

The best way to write

is to write a filter. Does our company write a diff algorithm to determine what has been modified? only upload the modified or new
. Your requirement is to upload

.
mylists = mylists.filter(x => !x.ser_ids.tirm() && !x.group.tirm()) 

but you only need the third

if (!mylist[2]user_ids.tirm() && !mylist[2].group.tirm()) {
   mylist = mylist.slice(0,2)
}

in fact, it's best not to change the original data. The best thing to do is to manipulate it with a deep copy of the new data
because if the backend makes an error, you can't do the same operation again when your original data changes

.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b315fc-2bd7e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b315fc-2bd7e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?