Skip to content

Suggestion: automatically bind props default value functions to current vm #1382

@OEvgeny

Description

@OEvgeny

Sometimes we need to set objects/arrays as default values of property in props. In these cases we need to specify a function that will return default value (docs link).

My suggestion is to automatically bind this kind of functions to current vm. So we can get access to vm context.

Now there are in global context:

props: {
  myProp: {
    type: Object,
    default: function () {
      console.log(this) // Window
      return {}
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions