Skip to content
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

Prop type conversion fails on Custom Element with camelCase prop name #5374

Closed
crackalak opened this issue Feb 8, 2022 · 0 comments · Fixed by #5377
Closed

Prop type conversion fails on Custom Element with camelCase prop name #5374

crackalak opened this issue Feb 8, 2022 · 0 comments · Fixed by #5377
Assignees
Labels
🐞 bug Something isn't working scope: custom elements

Comments

@crackalak
Copy link

Version

3.2.30

Reproduction link

stackblitz.com

Steps to reproduce

Click the button to increment the page number

What is expected?

No type check warnings should appear in the console

What is actually happening?

[Vue warn]: Invalid prop: type check failed for prop "pageNumber". Expected Number with value 1, got String with value "1".


I think the key chould be camelized before checking _numberProps here:

protected _setAttr(key: string) {
let value = this.getAttribute(key)
if (this._numberProps && this._numberProps[key]) {
value = toNumber(value)
}
this._setProp(camelize(key), value, false)
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐞 bug Something isn't working scope: custom elements
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants