Skip to content

props of vnode didn't initialize #4008

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

Closed
kooriookami opened this issue Jun 27, 2021 · 5 comments
Closed

props of vnode didn't initialize #4008

kooriookami opened this issue Jun 27, 2021 · 5 comments

Comments

@kooriookami
Copy link

kooriookami commented Jun 27, 2021

Version

3.1.2

Reproduction link

https://codesandbox.io/s/boring-hofstadter-h2jee

Steps to reproduce

Hi, please look at the console.
image

What is expected?

It's expected to get merged props, like

{
  "aBC": "a-b-c",
  "a1": "a1",
  "b2": "b2",
  "c3": "c3",
}

What is actually happening?

The props of vnode didn't convert to camel case, and there's no default props, such as a1 b2 c3.

@edison1105
Copy link
Member

duplicate of #3953

@kooriookami
Copy link
Author

kooriookami commented Jun 27, 2021

duplicate of #3953

@edison1105 Sorry, I didn't want to mention undefined attrs are not being passed, so I changed the description. I give all type.props a default value.
How can the props convert to camel case automatically? Like a-b-c to aBC. And is there any way to merge type.props to props?

@edison1105
Copy link
Member

is this what you want: https://codesandbox.io/s/frosty-flower-21wge?file=/src/components/HelloWorld.vue
I'm a bit confused about your feature.

@kooriookami
Copy link
Author

is this what you want: https://codesandbox.io/s/frosty-flower-21wge?file=/src/components/HelloWorld.vue
I'm a bit confused about your feature.

Yes, I mean this. It's the same value of props in setup. But I wonder why they are different.

This is the link that I got props in setup.
https://codesandbox.io/s/competent-chatterjee-y5ipx?file=/src/components/HelloWorld.vue

@LinusBorg
Copy link
Member

LinusBorg commented Jun 27, 2021

vnode.props only contains the props actually passed to the vnode during render of the parent. default values and camelCase conversion are handled in the component instance and are not reflected on the vnode.

This is not a bug. Think of vnode.props as the raw input.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants