Skip to content

Private scope for non-reactive data and methods #1988

Closed
@ardoramor

Description

@ardoramor

Some data that is being kept track of by a component does not need to be made reactive. Currently, there is no one place to organize private data like that. Values stores in data, even if prefixed with underscore (e.g., _privateStuff), get methods added for every key of the object. I would like a dedicated space designated by Vue for private data and functions that will not be made reactive. I realize that I even now can create something like private or _private but there is no guarantee that it will not clash with Vue's future development.

It would be great to have a $private namespace allocated. It can be populated from private key of the component configuration object:

{
data: function () {...},
props: {},
methods: {},
private: {
// private variables that are not made reactive and are not watched
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions