Introduction
In the previous chapter, you were introduced to the concepts of single-file components and the Vue API, which provides access to methods, directives, and data properties. Building on these foundations, we will be introducing computed properties, which, like data properties, are reactive in the UI but can perform powerful calculations, and their results are cacheable, increasing the performance of your project. When building e-commerce stores, you will usually want to calculate pricing and cart items reactively as users interact with your UI, which in the past would need to be achieved without a page reload using something like jQuery
. Vue.js makes short work of these common frontend tasks by introducing computed properties that react immediately to frontend user input.
Let's begin by introducing reactive data that can be computed on the fly and understanding how to call and manipulate asynchronous data.