Skip to content

Files

Latest commit

 

History

History
52 lines (41 loc) · 1.06 KB

no-deprecated-props-default-this.md

File metadata and controls

52 lines (41 loc) · 1.06 KB

Pattern: Use of this within the props default value factory function

Issue: -

Description

This rule reports the use of this within the props default value factory functions. In Vue.js 3.0.0+, props default value factory functions no longer have access to this.

<script>
export default {
  props: {
    a: String,
    b: {
      default () {
        /* ✗ BAD */
        return this.a
      }
    }
  }
}
</script>
<script>
export default {
  props: {
    a: String,
    b: {
      default (props) {
        /* ✓ GOOD */
        return props.a
      }
    }
  }
}
</script>

Further Reading