Computed fields 4 / 42
More complex scenarios can convolute our template unnecessarily. This is where computed fields come into play.
Under the property computed
(which unlike data
is an object), we define getters that can be accessed just like state and are cached by Vue.
Notice how inside <script>
we write normal JavaScript. So, unlike in the template, you have to access title
using this.title
.
Try adding a computed field for titleLowerCase
.