I have an API that has a structure in JSON format, and I need to search deeper into the third level of the array. I was using away but it doesn't work, so I was going to search for a library to do what I need someone tell me to go to the Loadash library, He said it will achieve what I am looking for. I implemented with on my way but is not working, so I need to know what is wrong with my code.
Edit
I updated my question and add HTML code to show you what I need it because your answers are not given me what I expect.
<temlate>
<div>
<div class="col-lg-6">
<input type="email"
class="form-control-in"
id="exampleInputEmail1"
aria-describedby="emailHelp"
placeholder="search"
v-model="search">
</div>
<div class="page-output" v-for="(asset, i) in doFilter" :key="i">
<target-body :asset="asset"
:search_by="search_by"></target-body>
</div>
</div>
</template>
domainAssets =
[
{
"id":122,
"name":"Game",
"web_technologies":[
{
"name":"RequireJS",
"categories":[
"JavaScript Frameworks"
]
}
]
},
{
"id":123,
"name":"Game2",
"web_technologies":[
{
"name":"Composer",
"categories":[
"PHP Frameworks"
]
}
]
}
]
I am using vuejs to search:
//...
data(){
return {
search_by: 'web_technologies',
search: 'PHP',
}
},
computed: {
...mapState({
domainAssets: state => state.Domain.domainAssets
}),
doFilter(){
let self = this;
return this.domainAssets.filter(function(domain){
if(self.search_by == "web_technologies"){
return _.includes(_.get(domain.web_technologies, self.search_by), self.search.toLowerCase());
}
}
}
//..