The Wayback Machine - https://web.archive.org/web/20170523205903/https://github.com/vuejs/vue/issues/5615
Skip to content

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

Projects
None yet
3 participants

sparamasivan commented May 5, 2017 edited by posva

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 changed the title from Dynamic slot name binded from v-for directive not working with scoped slots to Dynamic slot name bound from v-for directive not working with scoped slots May 5, 2017

Member

posva commented May 5, 2017

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

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'
      }
    }
});
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/)

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.

yyx990803 closed this in 0ccefff May 9, 2017

Thank you folks for fixing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can't perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.