Subscribe on changes!

`<slot>` should have a shorthand syntax that mirrors `<template>`'s shorthand

avatar
Dec 10th 2021

What problem does this feature solve?

It's a more intuitive syntax to use named scoped <slot> by unifying the slotProps-binding syntax between <template> and <slot>

Shorthand for template:

<template #text="{ str }"><p>{{ str }}</p></template>

Shorthand for slot:

<slot #text="{ str: 'Hello' }" />

What does the proposed API look like?

Before:

<slot name="text" :str="'Hello'" />

After:

<slot #text="{ str: 'Hello' }" />

avatar
Dec 10th 2021

This seems more confusing than the existing syntax, especially given than both are supported since slot would be used in different cases and could lead to breaking existing cases. If you still think this is worth pursuing, please follow the RFC process in the rfcs repo.