-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Open
Labels
Description
What problem does this feature solve?
In most of cases, it's not really comfortable to use initialProp
as prop name, for example, or have normalizedProp
inside a component, which takes some passed prop and transforms it. Code looks bloated and reminds more workaround than a good solution.
Having ability to change attribute name of prop would be great. Something like:
rawProp: { attributeName: "prop" }
What does the proposed API look like?
<component size="md"> ... </component>
computed: {
size: {
switch (this.rawSize) { ... } // returns something in case blocks
}
},
props: {
rawSize: {
attributeName: "size",
type: String
}
}
Thus, using any of proposed solutions above, this.size
inside component would return transformed value (for example, h4
or just 4
).
I believe having this feature would be very awesome and help us to write cleaner code.
bimbiltu, seaskyways, codebryo, vinicius73, 4refael and 54 more