I have some code which filters an array of objects based on a search input, it filters based on the search variable. I'd like to be able to search based on this, and potentially other keys in my object:
import HelpGuides from '~/static/help/help-guide.json';
export default {
head: {
title: 'Help'
},
data () {
return {
guides: HelpGuides,
search: ''
}
},
computed: {
filteredGuides: function() {
return this.guides.filter(guide => {
return guide.title.toLowerCase().includes(this.search.toLowerCase())
})
}
}
}
Above is my code, which filters the title key based on the search input, however, each object contains title, tags and body, tags is an array, and body is a string.
How would I go about doing this?