I am working on developing a filtering system that checks for the existence of project technologies in the arrOfObjs.name
. If a match is found, then the filter will allow the project to be displayed in the DOM. This filter specifically involves using a computed value in VueJS.
For example:
arrOfObjs = [{name: 'test1', image: 'testing1'}, {name: 'test2', image:'testing2'}]
projects:
[
{
name: "testproject",
description: "lorem ipsum",
technologies: ["test2", "test7", "test3"]
},
{
name: "atest",
description: "lorem ipsum",
technologies: ["test1", "test2", "test5"]
},
]
This is my current approach:
computed: {
myComputedVal () {
projs = []
this.projects.forEach(p => {
p.technologies.forEach(t => {
this.arrOfObjs.filter(o => {
if (o.name == t) {
return p // potentially store in array like projs = [...projs, p] and then return projs
}
})
})
})
}
}
I aim to determine whether any of the technology values exist within arrOfObjs.name
, and if so, either return the matching project or add it to an array for later computation. Currently, no action is being taken based on the existing code.