# Props Default Function this Access
breaking

Props default value factory functions no longer have access to this.

Instead:

  • Raw props received by the component are passed to the default function as argument;

  • The inject API can be used inside default functions.

import { inject } from 'vue'

export default {
  props: {
    theme: {
      default (props) {
        // `props` is the raw values passed to the component,
        // before any type / default coercions
        // can also use `inject` to access injected properties
        return inject('theme', 'default-theme')
      }
    }
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14

# Migration Strategy

Migration build flag: PROPS_DEFAULT_THIS

Deployed on Netlify.
Last updated: 2021-06-07, 16:47:59 UTC