Skip to content

The solution for props name start with "data-" when hyphenated prop names been deprecated #1034

Closed
@butsalt

Description

@butsalt

I'm commonly using props start with data-. data-* is recommended to exchange proprietary information. Through this way, I don't need to worry about the attribute that I use to exchange data will cause any impact on dom.

props: {
    "data-checked": {
        type: Boolean
    }
}

If hyphenated prop names have been deprecated, I wish I can use props start with 'data-' like this in future:

<my-component data-checked></my-component>
props: {
    "checked": Boolean
}
this.checked //true

And

<my-component data-my-msg="something"></my-component>
props: {
    "myMsg": String
}
this.myMsg //"something"

If not find properer attribute, then

<my-component my-msg="something"></my-component>
props: {
    "myMsg": String
}
this.myMsg //"something"

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