Subscribe on changes!

DIRECTLY inject grandsons' slots to grand parent components

avatar
Nov 23rd 2020

What problem does this feature solve?

slots in the grand son that need to be exposed in its grand parent component must be expose to its parent components and then be handed off to its grand parents components by its parent components.

What does the proposed API look like?

in grandson component:

<slot provide name="slotOfGrandson"/>

in grandparent component:

<template inject #slotOfGrandson/>

https://github.com/vuejs/vue/issues/11788

avatar
Nov 24th 2020

I find this a bit fragile and more implicit that passing slots through components in between the parent and its children because any component in between could use the slot name in the middle of the chain, and those could be toggled dynamically, ending up in quite confusing patterns.

In any case, this should go through an RFC: https://github.com/vuejs/rfcs/ with a lot more details and examples. Can you start the discussion there?

avatar
Nov 24th 2020

OK, let's discuss this in an RFC, thanks @posva .