-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[In Review] 2.6 Updates #1939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[In Review] 2.6 Updates #1939
Conversation
src/v2/guide/render-function.md
Outdated
@@ -536,6 +536,7 @@ Everything the component needs is passed through `context`, which is an object c | |||
- `props`: An object of the provided props | |||
- `children`: An array of the VNode children | |||
- `slots`: A function returning a slots object | |||
- `scopedSlots`: (2.6.0+) An object that exposes passed-in scoped slots |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we add note about this includes slots
as functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
src/v2/guide/syntax.md
Outdated
<video v-bind:muted.prop="isMuted"> ... </video> | ||
|
||
<!-- shorthand --> | ||
<video .muted="isMuted"> ... </video> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH I think this shorthand somewhat breaks the existing unified syntax of Vue's directives:
v-directive:argument.modifier="value"
Where :
is always followed by an argument and .
is always followed by a modifier. .muted
along may look like a modifier without directive/argument part and might be somewhat confusing if users haven't got to this part of the documentation yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A modifier would only be a modifier if it has something to modify, right? So a standalone modifier doesn't even make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yyx990803 I agree having a standalone modifier doesn't make sense, but I think @Justineo's point is that in the context of attributes, .
has always meant "this is the beginning of a modifier", so even my first thought when seeing this just now was, "Is this a modifier for something implicit or a modifier on the element/component level?" Given the immediate confusion caused by the syntax, even on the core team, and especially given how controversial adding the v-slot
shorthand was, I feel like this might merit an RFC of its own. What do you think?
Co-Authored-By: yyx990803 <yyx990803@gmail.com>
Co-Authored-By: yyx990803 <yyx990803@gmail.com>
All 2.6 updates are now covered - would appreciate some review from @chrisvfritz on the revised slots guide (commit) |
src/v2/api/index.md
Outdated
@@ -2389,6 +2377,40 @@ Used to denote a `<template>` element as a scoped slot, which is replaced by [`s | |||
- [Dynamic Components](../guide/components.html#Dynamic-Components) | |||
- [DOM Template Parsing Caveats](../guide/components.html#DOM-Template-Parsing-Caveats) | |||
|
|||
### slot <sup>replaced</sup> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we mark slot
and slot-scope
as “deprecated”? Since they are still available, unlike scope
, which is removed and replaced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. 👍
src/v2/guide/components-slots.md
Outdated
|
||
When you want to use data inside a slot, such as in: | ||
<p class="tip">The `v-slot` syntax is introduced in 2.6.0 and is not supported in older versions. The legacy `slot` and `slot-scope` syntax is still supported in 2.6, and is documented [here](#Legacy-Syntax).</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think maybe it’s better to move this section to the beginning of the v-slot
part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went through and made some tweaks, but overall it's looking good to me. Like @Justineo though, I was also surprised (and somewhat alarmed) by the new DOM prop shorthand, because:
- It breaks the pattern of shorthands only replacing the directive name, since it replaces a directive name and modifier.
- Since
.
usually precedes a modifier, users may wonder if this is some element/component-level modifier (it was my initial thought, before I took in the full context and remembered thatmuted
was a DOM prop of audio elements). - It increases the size and complexity of the Essentials, since the best place to introduce it is probably with the
v-bind
shorthand, even though we wouldn't otherwise mention DOM prop bindings there. - It's such a seldomly used feature that when people see the shorthand for the first time, it's extremely likely that they won't be familiar with / remember DOM prop bindings, even if they once read about it.
- I may have missed it, but I didn't see an RFC for this shorthand. If we needed one for the
v-slot
shorthand, shouldn't we have this go through an RFC too?
This reverts commit f639b83.
@chrisvfritz I've reverted it now in this PR and hidden it behind a flag in core (disabled by default). |
@Justineo added clarification for that case. |
@yyx990803 Sounds good. 👍 |
No description provided.