const data = {
specs: [
{
id: 1,
name: "",
values: [
{ value: "", id: 10 },
{ value: "", id: 1 },
{ value: "", id: 2 }
]
},
{ id: 2, name: "", values: [{ value: "", id: 3 }] }
],
skus: [
{ id: 35, price: 400, p: "2:3;1:10;", n: ":;:;" },
{ id: 36, price: 350, p: "2:3;1:1;", n: ":;:;" },
{ id: 37, price: 480, p: "2:3;1:2;", n: ":;:;" }
]
}
as the data structure above, specs is combinable. The data that is combined by array cycle is 1code > |
1code > 2code 3
| 1code > 2code 3
. Then compare it with p in skus to get the price field value.
the question now is that the order of strings in array combinations in specs is not equivalent to that in skus. Is there any other way to deal with this data? String feels unreasonable