title: Vuejs Custom Search Filter Not Working With Computed
body: <p>I am trying to have custom filter search functionality . When i try to filter the records based on keywords in filter search, it does nothing but displays all posts. This always has this.search as ''. What is the potential fix in this case? </p>
  
  <pre><code>&lt;form&gt;
      &lt;fieldset class="w-100 left"&gt;
          &lt;input type="text" placeholder="Filter posts by keyword" v-model="search"/&gt;
      &lt;/fieldset&gt; 
  &lt;/form&gt;
  &lt;div&gt;
      &lt;div id="mainSec"&gt;
          &lt;div v-for="post in filteredPosts"&gt;
  
              &lt;div v-for="result in results" v-if="post.userId == result.id" class="left ml-3 mt-3" &gt; 
                  &lt;p &gt;{{result.name}}&lt;/p&gt;
                  &lt;p&gt;{{result.email}} | {{result.address.city}}&lt;/p&gt;
              &lt;/div&gt;  
              &lt;p style="float:left;width:100%"&gt;&lt;strong&gt;{{post.title.toUpperCase()}}&lt;/strong&gt;&lt;/p&gt;
              &lt;p style="float:left;width:100%"&gt;{{post.body}}&lt;/p&gt;
          &lt;/div&gt;  
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;/html&gt;
  &lt;script&gt;
  
  var  vm = new Vue({
      el: '#mainSec',
      data() {
          return {
              search : '',
              results : [],
              posts : []
          };
      },
      async created() {
              try{
                  axios.get(urlUsers).then(response =&gt; {
                      this.results = response.data
                  });
                  axios.get(urlPosts).then(response =&gt; {
                      this.posts = response.data
                  });
  
              }
              catch(error){
                  console.log("Error is " + error);
              }
  
      },
      computed : {
          filteredPosts (){
              if(this.search){
                  return this.posts.filter((item)=&gt;{
                      return item.title.match(this.search);
              })
          }else{
              return this.posts;
          }
      }
  })
  &lt;/script&gt;
  </code></pre>