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

Dynamic slot name bound from v-for directive not working with scoped slots #5615

Closed
sparamasivan opened this issue May 5, 2017 · 5 comments

Comments

@sparamasivan
Copy link

sparamasivan commented May 5, 2017

Version

2.3.2

Reproduction link

https://jsfiddle.net/frctmhLd/3/

Steps to reproduce

Create a scoped slot using the element, as is necessary
Use dynamic props to set the slot property on the
Attempt to utilize this slot

What is expected?

The slot is loaded and display correctly

What is actually happening?

Dynamic properties don't seem to work on the component, so the "slot" property is getting set to null and it is not being loaded

@posva posva changed the title Dynamic slot name binded from v-for directive not working with scoped slots Dynamic slot name bound from v-for directive not working with scoped slots May 5, 2017
@posva
Copy link
Member

posva commented May 5, 2017

Not sure how to label it so, labelling it as improvement and bug

@defcc
Copy link
Member

defcc commented May 7, 2017

@posva @sparamasivan Am I missing something? There are two root elements in the parent compoent, so an error is reported.

Vue.component('parent', {
    template: '' +
    	'<child>' +
      	'<template :slot="test" scope="props">' +
        	'<p>{{props.text}}</p>' +
        '</template>' +
      '</child>' +
    	'<child>' +
      	'<template v-for="slotName in slotNames" :slot="slotName" scope="props">' +
        	'<p>{{props.text}}</p>' +
        '</template>' +
      '</child>',
    data: function () {
      return {
        slotNames: ["test", "test1", "test2"],
        test: 'test'
      }
    }
});

@posva
Copy link
Member

posva commented May 8, 2017

@defcc Oh, sorry, I forgot to update the repro, yeah, it's wrong, but adding a single root element still showcases the problem (https://jsfiddle.net/frctmhLd/3/)

@defcc
Copy link
Member

defcc commented May 8, 2017

I also updated the demo here. https://jsfiddle.net/frctmhLd/4/

Seems to be a bug with scoped slots.

@sparamasivan
Copy link
Author

Thank you folks for fixing this.

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

No branches or pull requests

3 participants