When I write the code like this, it works:
<script>
export default {
props: ["notes"],
computed: {
hasNotes() { return this.notes && this.notes.some(x => x); }
}
};
</script>
but when I write it like this, it fails:
<script>
export default {
props: ["notes"],
computed: {
hasNotes : ()=> this.notes && this.notes.some(x => x)
}
};
</script>
... and I don't understand why. What am I doing wrong here?
I'm certain this is a dupe of something, but an arrow function uses lexically scoped this
so this
doesn't mean what you think it means inside the arrow function.