Search Filter in vuejs

1

When I use the search engine, I do not take into account the first letter unless I capitalize it, I'm using vue.js, vue-cli webpack

With the following code I make the search work:

  computed: {
    filteredPacks: function(){
      return this.packs.filter((pack) => {
        return pack.name.match(this.search);
      })
    }
  },

With this input I do the search:

<input type="text" v-model="search" placeholder="search">

and this is what I do look for:

<div class="card-body">
  <h4 class="card-title">{{pack.name.toUpperCase()}}</h4>
</div>

But when I do the search like this, it shows me what I need:

On the other hand, if I want to find what has the letter a or something with a lowercase letter, I do not take into account the one that starts with a capital A [! [enter the description of the image here] [2]] [2]

What is going wrong?

    
asked by Christian Vazquez 20.10.2017 в 20:26
source

1 answer

2

the answer was very simple, just add .toLowerCase () after the data deaseado:

   filteredPacks: function(){
      return this.packs.filter((pack) => {
        return pack.name.toLowerCase().match(this.search);
      })
    }
    
answered by 20.10.2017 / 21:34
source