title: Using method function in v-if
body: <p>I’m trying to use a function in a v-if directive like that in a vue template</p>
  
  <pre><code>    &lt;template&gt;
  
      &lt;ul class="list-group"&gt;
          &lt;li class="list-group-item list-group-item-info"&gt;
              &lt;div class="row"&gt;
                  &lt;div v-for="col in colss" class="" :class="bootstrapClass"&gt;{{col | capitalize}}&lt;/div&gt;
              &lt;/div&gt;
          &lt;/li&gt;
  
          &lt;li v-for="item in datas[collectionsindatas['reference']]" class="list-group-item"&gt;
              &lt;div class="row"&gt;
                  &lt;div v-for="property in columns.slice(0,(columns.length))" class="" :class="bootstrapClass"&gt;{{ item[property] }}&lt;/div&gt;
  
                  &lt;div v-if="compareCollections(item[comparecol],datas[collectionsindatas['compare'][comparecol]])" class="" :class="bootstrapClass"&gt;
                      OK
                  &lt;/div&gt;
                  &lt;div v-else class="" :class="bootstrapClass"&gt;!!NOK!!&lt;/div&gt;
  
              &lt;/div&gt;
  
          &lt;/li&gt;
      &lt;/ul&gt;
  
  &lt;/template&gt;
  </code></pre>
  
  <p>and my methods are like that :</p>
  
  <pre><code>methods:{
  compareCollections:function(reference,compare){
                  if(compare!='undefined'  &amp;&amp; compare!=''){
                      if(compare===reference){
                          return true;
                      }
                      return false;
                  }
                  return false;
              },
  }
  </code></pre>
  
  <p>It fails with this message : [Vue warn]: Property or method is not defined on the instance but referenced during render</p>
  
  <p>It fells myself better to use a method instead writing many things ugly in the v-if directive like</p>
  
  <pre><code>v-if="datas[collectionsindatas['compare'][comparecol]]!='undefined'&amp;&amp;(item[comparecol]===datas[collectionsindatas['compare'][comparecol]])"
  </code></pre>
  
  <p>what is the right way to do this ?</p>
  
  <p>Thanks for your help</p>