Answer the question
In order to leave comments, you need to log in
How to make a computed property to get the property of an object when it is not available?
Essence: there is a component that has the following properties:
computed: {
activity() { return this.activityLoaded ? this.$store.getters.getActivityById(this.id) : null; },
...
votes() { return (this.activity && this.activity.vote && this.activity.vote.count) ? this.activity.vote.count : 0 }
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question