v-bind="obj" syntax with scoped slot #4529

Closed
jacobmischka opened this Issue Dec 20, 2016 · 0 comments

Projects

None yet

1 participant

@jacobmischka
jacobmischka commented Dec 20, 2016 edited

I'm trying to make a custom list component using a scoped slot like the one in the docs, and I would like to expose all of the item properties as props to the template. Unfortunately, the v-bind="obj" syntax doesn't seem to be working for me in a scoped slot. Is this deliberate?

Regular v-bind:prop="obj.prop" syntax is working correctly, but it would be great if I could expose everything at once.

I don't believe I'm making a mistake, but sincere apologies if I am, or if this has been mentioned somewhere else that I missed.

Thank you!


Entry point:

<custom-list :items="listItems">
	<template scope="item">
		<li>{{ item }}</li>
	</template>
</custom-list>

CustomList with implicit v-bind object binding:

<template>
	<ul>
		<slot v-for="item of items" v-bind="item"></slot>
	</ul>
</template>

Result:

image

CustomList with explicit prop binding:

<template>
	<ul>
		<slot v-for="item of items" :id="item.id"></slot>
	</ul>
</template>

Result:
image

@yyx990803 yyx990803 closed this in 0eb8cdc Dec 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment