Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a7a53bd

Browse filesBrowse files
committed
remove shorthand from current RFC
1 parent 914ab26 commit a7a53bd
Copy full SHA for a7a53bd

File tree

Expand file treeCollapse file tree

1 file changed

+0
-86
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+0
-86
lines changed

‎active-rfcs/0000-new-scoped-slots-syntax.md

Copy file name to clipboardExpand all lines: active-rfcs/0000-new-scoped-slots-syntax.md
-86Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -336,89 +336,3 @@ The change is fully backwards compatible, so we can roll it out in a minor relea
336336
In 3.0 we do plan to eventually remove `slot-scope`, and only support the new syntax. We will start emitting deprecation messages for `slot-scope` usage in the next 2.x minor release to ease the migration to 3.0.
337337

338338
Since this is a pretty well defined syntax change, we can potentially provide a migration tool that can automatically convert your templates to the new syntax.
339-
340-
# Unresolved questions
341-
342-
### Shorthand Syntax
343-
344-
In a previous draft of this proposal, we proposed a shorthand for the new syntax:
345-
346-
``` html
347-
<foo ()="{ msg }">
348-
{{ msg }}
349-
</foo>
350-
351-
<foo>
352-
<template (header)="{ msg }">
353-
Message from header: {{ msg }}
354-
</template>
355-
356-
<template (footer)>
357-
A static footer
358-
</template>
359-
</foo>
360-
```
361-
362-
Here the `v-slot:arg` is translated into `(arg)`.
363-
364-
However, there were very mixed opinions on which symbol should be used for the shorthand, or whether a shorthand is needed at all. Two most favored alternative symbols for the shorthand are listed below:
365-
366-
### `#`
367-
368-
``` html
369-
<foo #="{ msg }">
370-
{{ msg }}
371-
</foo>
372-
373-
<foo>
374-
<template #header="{ msg }">
375-
Message from header: {{ msg }}
376-
</template>
377-
378-
<template #footer>
379-
A static footer
380-
</template>
381-
</foo>
382-
```
383-
384-
### `&`
385-
386-
``` html
387-
<foo &="{ msg }">
388-
{{ msg }}
389-
</foo>
390-
391-
<foo>
392-
<template &header="{ msg }">
393-
Message from header: {{ msg }}
394-
</template>
395-
396-
<template &footer>
397-
A static footer
398-
</template>
399-
</foo>
400-
```
401-
402-
Personally, I think a shorthand is a beneficial addition, as it makes the slot designation jump out from normal props and directives and makes the template easier to scan.
403-
404-
Some may argue that scoped slots are not that commonly used and therefore don't really need a shorthand. On that front, I actually believe scoped slot is an important mechanism for building 3rd party component suites that are highly customizable. For a user using a component collection with an API that relies heavily on slots, a shorthand will become quite valuable.
405-
406-
After the initial round of feedback I agree that `()` as the shorthand can be potentially confusing to beginners, and am now leaning towards `#`. Some examples of the usage in a real-world library that relies on scoped slots ([vue-promised](https://github.com/posva/vue-promised)):
407-
408-
``` html
409-
<Promised :promise="usersPromise">
410-
<template #pending>
411-
<p>Loading...</p>
412-
</template>
413-
414-
<template #="users">
415-
<ul>
416-
<li v-for="user in users">{{ user.name }}</li>
417-
</ul>
418-
</template>
419-
420-
<template #rejected="error">
421-
<p>Error: {{ error.message }}</p>
422-
</template>
423-
</Promised>
424-
```

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.