Skip to content

Files

Latest commit

 

History

History
32 lines (23 loc) · 568 Bytes

no-computed-properties-in-data.md

File metadata and controls

32 lines (23 loc) · 568 Bytes

Pattern: Accessing computed property in data()

Issue: -

Description

The computed property cannot be accessed in data() because is before initialization.

<script>
export default {
  data() {
    return  {
      /* ✗ BAD */
      bar: this.foo
    }
  },
  computed: {
    foo () {}
  }
}
</script>

Further Reading