Utilizing Vue.js, I am attempting to iterate through an array of levels. I successfully received the response json in actions with a forEach function like:
let filters = []
const array = response.data
array.forEach((element) => {
filters.push(element)
})
After storing the data in state, is there a way to filter by TYPE and then iterate over the Data in order to render it in a select element or any other component using V-for in Vue.js?
This is my sample JSON file:
[
{
'type': 'filter',
'datatype': 'str',
'data': [
{
'var_name': 'Gender',
'options': [
'Male',
'Female'
]
}
]
},
{
'type': 'filter',
'datatype': 'date',
'data': [
{
'var_name': 'From',
'options': []
}
]
},
{
'type': 'range',
'datatype': 'date',
'data': [
{
'var_name': 'From',
'options': []
},
{
'var_name': 'To',
'options': []
}
]
}
]