-
-
Notifications
You must be signed in to change notification settings - Fork 597
Fix corner case and add v-model support when prop validation #2241
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
Conversation
1bc21df
to
6de96f9
Compare
6de96f9
to
cd25383
Compare
normalized: normalizeHtmlAttributeNameToKebabCase(attr) | ||
normalized: normalizeHtmlAttributeNameToKebabCase( | ||
attr, | ||
definedProps.find(prop => prop.defaultModel)?.name ?? 'value' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would write my logic here:
- If it's
v-model
, create a function such asnormalizeModelAttr
that takes in thedefinedProps
and find it's normalized prop. You can make this function usenormalizeHtmlAttributeNameToKebabCase
. - If it's not, use
normalizeHtmlAttributeNameToKebabCase
directly
Currently this function is overloaded with too many things. Make one function do one thing is better (and then compose them).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hesitated when I wrote this function,
but I'm writing this anyway.
I will send a PR to refactor it.
3e05152
to
18ba3e9
Compare
Sorry I didn't wait. I'm planning to make a release soon to address the folidng issue and this issue, so I made the changes myself. |
Fixed #2236
Fixed #2237