Subscribe on changes!

Better dynamic v-slot: support

avatar
Oct 25th 2021

What problem does this feature solve?

Dynamic v-slot:[] can't recieve "'< By here However we have such scenario need to pass function and params to v-slot:[] like:

<template v-slot:[formatSlotName(' before')]>
  <h1>I'm slot 'before'</h1>
</template>

Reproduction Link: https://codesandbox.io/s/intelligent-bell-hkpd6?file=/src/App.vue

What does the proposed API look like?

No new API need. Is it possible to make compatibility by judging current attribute is slot to determine whether to emit error? If so. i am happy to create a PR ^_^

avatar
Oct 25th 2021

The restriction is by design as HTML attribute names cannot include ", ' and <. We don't want to introduce more caveats between usage of SFC and in-DOM templates. You can use a computed prop as a workaround.

avatar
Oct 26th 2021

@Justineo Thanks for your explanation. I have a little question. According to the specification. Is the design of v-slots:[slotsName] follows specification by Empty attribute syntax ?

avatar
Oct 26th 2021

Yes, v-slots:[slotsName] is an attribute name.