Open
Description
https://vuejs.org/v2/guide/render-function.html#slots-vs-children
With code example being:
<my-functional-component>
<p v-slot:foo>
first
</p>
<p>second</p>
</my-functional-component>
But v-slot
is not allowed to be used on the element itself. It should be at least:
<my-functional-component>
<template v-slot:foo>
<p>first</p>
</template>
<p>second</p>
</my-functional-component>
Or to be more clear:
<my-functional-component>
<template v-slot:foo>
<p>first</p>
</template>
<template v-slot>
<p>second</p>
</template>
</my-functional-component>
But after updating to the valid syntax, the following part is not accurate anymore:
For this component,
children
will give you both paragraphs,slots().default
will give you only the second, andslots().foo
will give you only the first.
children
won't give you both paragraphs, instead only those aren't wrapped inside the <template>
element. I'm not sure how to re-organize this part actually.