COMPUTED PROPERTIES

../../_images/115.png

Example

Comparison with methods

../../_images/412.png
  • Here we can see it updates really fast super fast.

    ../../_images/56.png
  • Like searching any title really fast.

    ../../_images/62.png ../../_images/71.png
  • And can also check the highest and the lowest rating of titles

    ../../_images/81.png ../../_images/91.png

#So using our computer property in place of data, we have a different view of this data. We have methods like we had before running off of that view instance and then in the computed values we have just another object.

../../_images/101.png
  • Here I am blurring out the method part , so just to focus on computed property. we have filteredfilms() and inside it we have RegExp to get rid of capitalisation thing - lower and uppercase.

    ../../_images/116.png
  • So, the only change we made in computed property code is: instead of v-for=”entry in ratingsInfo” we change it to v-for=”entry in filteredfilms”. Instead of using ratings info like we had in this, in our data property we are just changing it to filtered.

    ../../_images/121.png