Pattern: Accessing computed property in data()
Issue: -
The computed property cannot be accessed in data()
because is before initialization.
<script>
export default {
data() {
return {
/* ✗ BAD */
bar: this.foo
}
},
computed: {
foo () {}
}
}
</script>