How to use FormData to clear the data in it at once

after each FormData request, there can only be one delete. How to clear the data in it

created() {
 axios.post(url.backstagelistTools, this.toolsListFormData)
  .then(response => {
    this.tableDataList = response.data.dataList;
    //toolsListFormData
    this.toolsListFormData.delete("XAuthToken")
    this.toolsListFormData.delete("pageString")
    this.toolsListFormData.delete("designerName")
    
  })
  .catch(function(error) {
    console.log(error);
  });
}

Apr.06,2022

this.toolsListFormData = null 

?


how about new one again? You just have to delete and write a loop.

let keys = toolsListFormData.keys();
keys.forEach(k=>{
  this.toolsListFormData.delete(k)
})

this.toolsListFormData=new FormData()

re-new.


re-new one, emptying it is no different from new a new one

Menu