New to Vuejs, have a question on updating an array.
This is my data (status_arr):
{
"Approvals": [
{
"name": "Section 1",
"count": 10692
}
],
"Declines": [
{
"name": "Section 1",
"count": 1212
},
{
"name": "Section 2",
"count": 5
}
]
}
I need to add a "Pending" part of the above data dynamically. I'm not quite understanding the $set method on how to accomplish this. I need to add to the above dataset without effecting the rest of the data in it.
The documentation says to use:
this.$set(status_arr, itemIndex, [ { 'name': 'Section 1', 'count': 0 } ]);
Not sure how to add the Pending part with the data attached and if I'm adding to the array, how does it have an itemIndex for me to do so? Is there a this.$add function or something that works like a pop()?
Thanks for any help!
status_arrobject look like after adding the Pending part?