< /p>
How to generate the corresponding array based on the table, th======td.
var array = [];
madearray = [{
Product code:'12312312',
Product name: 'wiper blade',
Product Category:'11'
}]
What is the best way to save the following td when there are two data?
< br>When the selection is clicked, the corresponding array is generated and passed to insert to the parent page
Let me give you an idea: arr1 traverses the value of th, arr2 traverses the value of td, arr1 is used as key, arr2 is used as value
Then {} objects are packaged in. It can be done with Json format objects. Generally, Json is enough for data interaction. If that doesn't work, use Json to convert to array. Does anyone else have a better method?
Supplement:
Using another idea
[].map.call( domList, ()=>{}} )
, I wrote a demo that converts it directly into an array to see if it is what you want. of.[].map.call( domList, ()=>{}} )
写了个直接转成数组的demo,看看是不是你要的。格式是:
[{"name":"title","data":["2行1列","3行1列"]},{"name":"title".....]
The format is:[{"name":"title","data":["2 rows and 1 column", "3 rows and 1 column"]},{"name":"title".... .]
This is too complicated. Let me give you an idea for reference
When you select the product page, the API should return you a json data list, for example
[
{'Unique Identifier': 1, 'Encoding ':'', 'Car model':''},
...
]
When you click select, you should find the unique identifier, and then find this data in json
Define table header
Define data
Referenced the table components of Ele.me and Ant Financial