Posted On: Jan 02, 2023
Computed properties are properties in a Vue.js component that are calculated based on other properties in the component. They are like methods, but they are cached based on their dependencies, and will only re-evaluate when one of their dependencies changes. This can be more efficient than calling a method multiple times, especially if the method's result is expensive to compute.
Example:
<template> <div> <p>{{ reversedMessage }} </p> </div> </template> <script> export default { data() { return { message: 'Hello world!' } }, computed: { reversedMessage() { return this.message.split('').reverse().join('') } } } </script>
Never Miss an Articles from us.
Vue js is progressive javascript script used to create dynamic user interfaces.Vue js is very easy to learn.In order to..
Vue js comes with following features Templates Reactivity Components Transitions Routing ..
The Life cycle of each Vue instance goes through a series of initialization steps when it is created. – for example, ..