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

The render function doesn't pass attrs and slots when rendering dynamic components #12690

Closed
ilyasmez opened this issue Jul 21, 2022 · 2 comments

Comments

@ilyasmez
Copy link

Version

2.7.7

Reproduction link

stackblitz.com

Steps to reproduce

  • Use the render function (h) to render a custom Vue component (this is not a problem with native HTML elements).
  • Pass some props/attrs/slots in the render function.
  • You'll see that the component is rendered without the passed props/attrs/slots. As if they weren't passed at all (you'll get the typical Vue warning about required props for example).

What is expected?

The component should render with the passed props/attrs and slots.

What is actually happening?

The component is rendered plain... as if no data was passed.


This works in Vue 3.

@yyx990803
Copy link
Member

Vue 2 render functions work very differently from Vue 3. This was the part that had the biggest changes in Vue 3. Please make sure to read the relevant documentation: https://v2.vuejs.org/v2/guide/render-function.html

@ilyasmez
Copy link
Author

I was hoping that the new importable h would behave the same way as the Vue 3's :/
This will add some extra complexity to library authors.

I'll create a small helper to handle this, and maybe propose to add it to vue-demi, or publish it as a standalone library.

Thank you Evan!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants