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

[2.0.0-rc.1] Components are not rendered properly when passed to a v-for component via slot #3447

Closed
QingWei-Li opened this issue Aug 15, 2016 · 2 comments

Comments

@QingWei-Li
Copy link
Contributor

Vue.js version

2.0.0-rc1

Reproduction Link

https://jsbin.com/fadise/edit?html,js,output

Steps to reproduce

What is Expected?

abc
----
abc
----
abc
----
abc
----

What is actually happening?

----
----
----
abc
----
@rajibahmed
Copy link

I can confirm example is working with

vue@1.0.21

But not working on 2.0.~

//Best

@QingWei-Li QingWei-Li changed the title [2.0.0-rc1] Components are not rendered properly when passed to a v-for component via slot [2.0.0-rc.1] Components are not rendered properly when passed to a v-for component via slot Aug 15, 2016
@yyx990803
Copy link
Member

yyx990803 commented Aug 15, 2016

This is a wontfix - consider this a breaking change from 1.x.

The <span> example will also be fixed as it is not supposed to work.

The reason is that in 2.0, this is the same as using the same vnode multiple times in the same render tree, something that is not supported by the vdom patching algorithm. To put it another way: the same slot cannot be rendered more than once in the same template.

On the other hand, why would you want to render the exact same thing multiple times? In most cases, you want to render a list of things using different data. There's no way to pass data into slot content, so I'm not if this use case makes sense at all.

I can see that you are trying to build an options component, the better way to do it is render the list of child components in the parent scope:

  <options>
    <my-option v-for="o in options" :data="o"></my-option>
  </options>

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

3 participants