My vue modules are structured like this:
[types.GET_PRODUCT_CATEGORIES] (state,{ stores }) {
state.product_categories = {}
console.log(stores);
stores.forEach(message => {
set(state.product_categories, message.id, message)
})
console.log('test')
console.log(state.product_categories)
},
When I use console.log(stores)
, the output is as follows:
https://i.sstatic.net/bzM8I.png
I am looking to transform this object into a two-dimensional array based on parent_category_id key.
Could someone guide me on how to achieve this?
Update :
For example:
parent_category_id = 1, 2, 3
parent_category_name = asia, europa, africa
id = 4, 5, 6, 7, 8, 9, 20
name = japan, korea, arab, england, spain, italy, south africa
The desired display format would be:
asia
japan
korea
arab
europa
england
spain
italy
africa
south africa
Hence, the need to convert the one-dimensional object into a two-dimensional structure.