What should I do if the data at the front end of the vue, is inconsistent with the data required by the background?

clipboard.png

now make a drop-down multi-selection, as shown in the figure, and the selected id is [2prime3]

.

but the background requires the data to be like this:

[
    {
        "appId":2,
        "direction":"1"
    },                    
    {
        "appId":3,
        "direction":"1"
    },
]

where direction is always dead for 1, how can I change it to the format I want at the back end?


var data= [2hr class= 3] .map (r = > {return {'appid':r,'direction':'1'}}); console.log (data)


function handleData(data) {
  let _data = data.map(item => {
    return {
      'appid': item,
      'direction': '1'
    }
  })
  return _data;
}

js to construct the array needed by the backend, foreach the array you get from the drop-down list (for example), put {appId:foreachItem,direction:1} in an array variable at a time, and finally pass the array to the backend

.
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-1bdbc27-312c1.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-1bdbc27-312c1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?