Skip to content

New (2.6 ) slot syntax results in slots not added to vm.$slots, breaking existing render functions #9421

Closed
@K900

Description

@K900

Version

2.6.1

Reproduction link

https://jsfiddle.net/3kpf9u54/4/

Steps to reproduce

  1. Observe the contents of the <template> displayed
  2. Change the code from <template slot="content"> to <template #content> or <template v-slot:content> and observe the contents stop being displayed
  3. Change the render function code from this.$slots.content to this.$scopedSlots.content() and observe the contents be displayed again

What is expected?

Contents are displayed all the time; old render functions don't break when used with new syntax

What is actually happening?

New syntax forces slots into being scoped, breaking existing render functions


I'm actually not sure if this is intentional or not, but it breaks Vuetify, and probably other things too. Assuming this is intentional, it makes writing functional components more difficult, as you have to either:

  1. check both this.$slots (for Vue pre-2.6) and this.$scopedSlots (for Vue post-2.6)
  2. only check this.$scopedSlots and ask Vue pre-2.6 users to add slot-scope everywhere so all slots become scoped
  3. only check this.$slots and ask Vue post-2.6 users to use the legacy syntax

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions