Assign props and handlers to slot elements

Viewed 12

Let's say that I have a component called tabs which utilizes the default slot with another component, tab:

<tabs>
  <tab>a</tab>
  <tab>b</tab>
</tabs>

Is there any way to programmatically assign things like event handlers and props to the tab components, from within the tabs component?

The closest thing I can think of is something like:

<component v-for="item of $slots.default" :is="item.type.name" v-bind="item.props" @click="..." />

Is this how the api is intented to be used?

0 Answers
Related