How to access a computed property from a method in a Single File Component with Vue.js
Solution 1:
You can access computed properties like a property
, not like a method
:
// correct
console.log(this.myProperty);
// wrong
console.log(this.myProperty());
Note: If you treat it as a method with paracentesis ()
it shall throw an error like this Error in v-on handler: "TypeError: this.myProperty is not a function"
.