-
-
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
Add warning for ambiguous usage of slot-scope
and v-for
on the same element
#6817
Comments
I don't know if this should be fixed. I would suggest users to explicitly use Consider this example: <child>
<div slot-scope="props" v-for="i in props.items"/>
</child> We should first expand it to But if we add an <child>
<div slot-scope="props" v-for="i in parentItems" :slot="props[i]"/>
</child> For this template, it should be compiled to <template v-for="i in parentItems">
<template slot-scope="props" :slot="props[i]">
<div></div>
</template>
</template> Update: maybe we can use a simpler strategy: |
The usage here is indeed ambiguous, I also suggest using an explicit |
slot-scope
and v-for
on the same element
It looks like warning is not possible to solve in some cases, see #7722 |
Version
2.5.2
Reproduction link
https://jsfiddle.net/xrecft4f/
Steps to reproduce
parent1 is not rendering anything, while parent2 is rendering correctly.
What is expected?
v-for should work if the slot-scope is given on the element.
What is actually happening?
As visible in the fiddle, parent1 is not rendering anything. Right now it only works if it's wrapped inside a template tag.
The text was updated successfully, but these errors were encountered: