Home > Blockchain >  How do I add option 2?
How do I add option 2?

Time:03-26

how to add one more data.channelTitle like data.title

computed: {
  filteredVideo() {
   return this.videos.filter(data => {
    return data.title.toLowerCase().includes(this.search.toLowerCase())
  })
}},

Like this: https://codepen.io/AndrewThian/pen/QdeOVa

CodePudding user response:

The question is vague so I assume you want to filter the list on basis of data.title as well as data.channelTitle as well. If that's the case then, add

data.title.toLowerCase().includes(this.search.toLowerCase()) || 
    data.channelTtile.toLowerCase().includes(this.search.toLowerCase())

This will filter out only if both the conditions(data.title and data.channelTtile) fail to match with this.search.

  • Related