Is there a way to efficiently utilize a nested object for generating Vue components?
My nested object structure is as follows:
"api": {
"v1": {
"groups": {
"create": true,
"get": true,
"item": {
"get": true,
"destroy": false
}
}
}
}
I aim to create a form with checkboxes for each value within the object. However, I am facing challenges in binding these values to Vue checkbox v-models.
One approach I attempted involved creating a list of lookup keys like ["api.v1.groups.create", "api.v1.groups.get"], and using a function like the one below to extract the entries:
getPerm (p) {
return p.split('.').reduce(
(xs, x) => (xs && xs[x]) ? xs[x] : null,
this.role.permissions)
}
Unfortunately, this method does not yield the desired reference and only provides the boolean value.