1. Look at the data format first, which took me nearly a morning to solve

1. This is the data format that the console brings you out

applicableFormatsQt: "[{\"storeCode\":\"012002\",\
"storeName\":\" Shopping mall \",\"dedicatedSiteFee\": \ \}]" "4254.90"
Copy the code

2. This is the copied data format

"[{"storeCode":"012002","storeName":"Shopping malls","dedicatedSiteFee":"4254.90"}]"
Copy the code

3. The console prints a lot more “\” in JSON format

The solution

Return (); return (); return (); return ()


 
SalesIncentive_tableData1 is an array
that.salesIncentive_tableData1=JSON.parse(response.data.data.salesIncentive)// First convert the string to JSON format
 var newArr = []; // Declare an empty array
 var json = []  // Declare an empty array
 for(var i  in that.salesIncentive_tableData1 ){
 newArr[that.salesIncentive_tableData1[i]]  = json[i]
    }
    // loop over the fetch
   return newArr
Copy the code

2. Assign to render3. The effect is as follows4. Get one of the data columns such as “storeName”

  var applicableFormats_other =JSON.parse(response.data.data.applicableFormatsQt)// Parse the data format
  var newArr = [];  // Declare an empty array
 for (let otherIndex = 0; otherIndex < applicableFormats_other.length; otherIndex++) {
  const element = applicableFormats_other[otherIndex];
    newArr.push(element.storeName);  // Get the name of the store in our data
    }
    // loop over
 that.ruleForm.applicableFormats_other=newArr.join(",");  // Separate with commas
Copy the code

This is all about parsing multiple data formats. I hope it will help you