[Vuejs]-How to render another component's scoped slot?

0👍

After some digging and a bit of fiddling with the code, I found that the following solution allowed to render properly :

// FragmentC.vue
{
  inject: ["$fragB"],
  components: { FragmentB },
  render(h){
    return /*some condition*/
    ? this.$scopedSlots.default(/* render own scoped slot */)[0]
    : h(
      FragmentB,
      {
          props: {/*fragB props*/},
          scopedSlots: {
              default: this.$fragB.$scopedSlots.default(/* render FragmentB scoped slot */)[0],
          }
      },
      [
          this.$fragB.$scopedSlots.default(/* render FragmentB scoped slot */)[0],
      ]
    );
  }
}

Leave a comment