-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transform data when properties are set on a component. #7657
Comments
You are asking for coerce to come back but it was intentionally removed in favour of computed properties in v2: #2873 |
That's my problem, computed properties don't replace this functionality. It's creating unwanted aliases when I just need one variable. |
Can you point me to the method of manually implementing coerce in Vue 2 via plugins or such as this is essential to my use case? |
You may be able to not use a prop and read the value from |
What problem does this feature solve?
It would be nice for components to have the ability to normalize their properties without having to create an additional computed property with an unwanted property name. Like "myProp" and computed version "myPropNormalized", when the only one I'll ever touch inside the component is "myPropNormalized". "myProp" might as well not exist after it has been normalized.
This would allow components to consume properties in multiple formats for their input but only work off a single format. Easier for both consumers of a component and coders of a component.
What does the proposed API look like?
I'm not the best API designer, but I suppose it would have to be in the prop validation:
The text was updated successfully, but these errors were encountered: