Struggling to access my question props in order to assign its property directly into my data properties. Although I can use the property directly from my template, I am unable to assign it into the data.
Currently, I can only retrieve the value of props from my template:
props: ['question'],
data () {
return {
}
};
computed: {
upVote () {
return this.question.upvoted
},
count () {
return this.question.vote_count
}
}
methods: {
upVoteIt () {
if(User.loggedIn()) {
this.upVote = !this.upVote
this.upVote ? this.incr() : this.decr()
}
},
incr () {
this.count ++
},
decr () {
this.count --
}
}
<v-icon size="50" :color="upcolor" @click="upVoteIt">fas fa-sort-up</v-icon>
<span> {{ count }} </span>
I have realized that I can receive the value by utilizing the props directly inside my template instead of attempting to reassign it to a data property.