-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
Functional components with multiple roots don't render properly when used with v-for #8468
Labels
Comments
have it been solved? |
liximomo
pushed a commit
to liximomo/vue
that referenced
this issue
Jul 26, 2018
So if I'm understanding: <my-functional v-for="item in items" :key="item.key" :item="item" /> Will render <template v-for="item in items">
<my-functional :key="item.key" :item="item" />
</template> |
Since
@sirlancelot thank you for your example, which fixed my issue. I think the new construction should be mentioned somewhere in the doc. |
f2009
pushed a commit
to f2009/vue
that referenced
this issue
Jan 25, 2019
aJean
pushed a commit
to aJean/vue
that referenced
this issue
Aug 19, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
2.5.16
Reproduction link
https://jsfiddle.net/kb9x8rLf/
Steps to reproduce
Create a functional component that returns multiple root elements via an array, i.e.:
Then use the functional component alongside
v-for
:What is expected?
It should render the functional component as expected.
What is actually happening?
The rendered view contains "undefined" for each item in the array.
The JSFiddle demonstrates how wrapping the functional component in a
<template>
tag with thev-for
directive fixes the issue, but the<template>
tag should not be required for this. Oddly enough, there are some circumstances where it renders properly. In my use-case, I had no issues with the multiple root elements when I put the component inside a<table>
, but when I wrapped the component with a<tbody>
I ran into this issue I'm reporting.The text was updated successfully, but these errors were encountered: