title: How to define variable in vue template?
body: <p><strong>Problem</strong></p>
  
  <p>I have the need to temporarily store the results of a method call in Vue templates. This is particularly common inside loops, where I cannot easily use computed properties.</p>
  
  <pre><code>&lt;ul&gt;
    &lt;li v-for="vehicleType in vehicleTypes" :key="vehicleType"&gt;
      &lt;h3&gt;{{ vehicleType }}&lt;/h3&gt;
      &lt;div v-if="getVehicleTypeData(vehicleType)"&gt;
       {{ getVehicleTypeData(vehicleType).costPerMile }}&lt;br&gt;
       {{ getVehicleTypeData(vehicleType).costPerHour }}&lt;br&gt;
      &lt;/div&gt;
    &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p><strong>Javascript snippet:</strong></p>
  
  <pre><code>getVehicleTypeData: function(vehicleType){
      let options = _.find(this.vehicleTypeOptions, (obj)=&gt;{
        return obj.vehicleType==vehicleType;
      });
  
      return options;
  }
  </code></pre>
  
  <p>To improve performance, I really need a variable to store the method call result.</p>
  
  <p>What is the Vue way to solve this problem?</p>