Skip to content

[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

Merged
merged 26 commits into from
Feb 4, 2019
Merged

[In Review] 2.6 Updates #1939

merged 26 commits into from
Feb 4, 2019

Conversation

yyx990803
Copy link
Member

No description provided.

@yyx990803 yyx990803 changed the title 2.6 Updates [WIP] 2.6 Updates Jan 15, 2019
@@ -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
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

<video v-bind:muted.prop="isMuted"> ... </video>

<!-- shorthand -->
<video .muted="isMuted"> ... </video>
Copy link
Member

@Justineo Justineo Jan 16, 2019

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.

Copy link
Member Author

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.

Copy link
Contributor

@chrisvfritz chrisvfritz Feb 1, 2019

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>
@yyx990803 yyx990803 changed the title [WIP] 2.6 Updates [In Review] 2.6 Updates Jan 29, 2019
@yyx990803
Copy link
Member Author

All 2.6 updates are now covered - would appreciate some review from @chrisvfritz on the revised slots guide (commit)

@@ -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>
Copy link
Member

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. 👍


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>
Copy link
Member

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. 👍

Copy link
Contributor

@chrisvfritz chrisvfritz left a 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 that muted 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?

@yyx990803
Copy link
Member Author

@chrisvfritz I've reverted it now in this PR and hidden it behind a flag in core (disabled by default).

@yyx990803
Copy link
Member Author

@Justineo added clarification for that case.

@chrisvfritz
Copy link
Contributor

@yyx990803 Sounds good. 👍

@yyx990803 yyx990803 merged commit 3cd3e69 into master Feb 4, 2019
@yyx990803 yyx990803 deleted the 2.6 branch February 4, 2019 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants