diff --git a/src/v2/api/index.md b/src/v2/api/index.md
index 77fb63baf3..292b598393 100644
--- a/src/v2/api/index.md
+++ b/src/v2/api/index.md
@@ -82,7 +82,9 @@ type: api
> In 2.2.0+, this hook also captures errors in component lifecycle hooks. Also, when this hook is `undefined`, captured errors will be logged with `console.error` instead of crashing the app.
- > In 2.4.0+ this hook also captures errors thrown inside Vue custom event handlers.
+ > In 2.4.0+, this hook also captures errors thrown inside Vue custom event handlers.
+
+ > In 2.6.0+, this hook also captures errors thrown inside `v-on` DOM listeners. In addition, if any of the covered hooks or handlers returns a Promise chain (e.g. async functions), the error from that Promise chain will also be handled.
> Error tracking services [Sentry](https://sentry.io/for/vue/) and [Bugsnag](https://docs.bugsnag.com/platforms/browsers/vue/) provide official integrations using this option.
@@ -402,6 +404,35 @@ type: api
- **See also:** [Render Functions](../guide/render-function.html)
+### Vue.observable( object )
+
+> New in 2.6.0+
+
+- **Arguments:**
+ - `{Object} object`
+
+- **Usage:**
+
+ Make an object reactive. Internally, Vue uses this on the object returned by the `data` function.
+
+ The returned object can be used directly inside [render functions](../guide/render-function.html) and [computed properties](../guide/computed.html), and will trigger appropriate updates when mutated. It can also be used as a minimal, cross-component state store for simple scenarios:
+
+ ``` js
+ const state = Vue.observable({ count: 0 })
+
+ const Demo = {
+ render(h) {
+ return h('button', {
+ on: { click: () => { state.count++ }}
+ }, `count is: ${state.count}`)
+ }
+ }
+ ```
+
+
In Vue 2.x, `Vue.observable` directly mutates the object passed to it, so that it is equivalent to the object returned, as [demonstrated here](../guide/instance.html#Data-and-Methods). In Vue 3.x, a reactive proxy will be returned instead, leaving the original object non-reactive if mutated directly. Therefore, for future compatibility, we recommend always working with the object returned by `Vue.observable`, rather than the object originally passed to it.
+
+- **See also:** [Reactivity in Depth](../guide/reactivity.html)
+
### Vue.version
- **Details**: Provides the installed version of Vue as a string. This is especially useful for community plugins and components, where you might use different strategies for different versions.
@@ -1391,7 +1422,7 @@ type: api
> New in 2.1.0+
-- **Type:** `{ [name: string]: props => VNode | Array }`
+- **Type:** `{ [name: string]: props => Array | undefined }`
- **Read only**
@@ -1401,6 +1432,12 @@ type: api
Accessing `vm.$scopedSlots` is most useful when writing a component with a [render function](../guide/render-function.html).
+ **Note:** since 2.6.0+, there are two notable changes to this property:
+
+ 1. Scoped slot functions are now guaranteed to return an array of VNodes, unless the return value is invalid, in which case the function will return `undefined`.
+
+ 2. All `$slots` are now also exposed on `$scopedSlots` as functions. If you work with render functions, it is now recommended to always access slots via `$scopedSlots`, whether they currently use a scope or not. This will not only make future refactors to add a scope simpler, but also ease your eventual migration to Vue 3, where all slots will be functions.
+
- **See also:**
- [`` Component](#slot-1)
- [Scoped Slots](../guide/components.html#Scoped-Slots)
@@ -1948,7 +1985,7 @@ type: api
### v-for
-- **Expects:** `Array | Object | number | string`
+- **Expects:** `Array | Object | number | string | Iterable (since 2.6)`
- **Usage:**
@@ -1976,6 +2013,8 @@ type: api
```
+ In 2.6+, `v-for` can also work on values that implement the [Iterable Protocol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol), including native `Map` and `Set`. However, it should be noted that Vue 2.x currently does not support reactivity on `Map` and `Set` values, so cannot automatically detect changes.
+
When used together with v-if, v-for has a higher priority than v-if. See the list rendering guide for details.
The detailed usage for `v-for` is explained in the guide section linked below.
@@ -2021,12 +2060,18 @@ type: api
+
+
+
+
+
+
@@ -2097,9 +2142,15 @@ type: api
+
+
+
+
+
+
@@ -2164,6 +2215,59 @@ type: api
- [Form Input Bindings](../guide/forms.html)
- [Components - Form Input Components using Custom Events](../guide/components.html#Form-Input-Components-using-Custom-Events)
+### v-slot
+
+- **Shorthand:** `#`
+
+- **Expects:** JavaScript expression that is valid in a function argument position (supports destructuring in [supported environments](../guide/components-slots.html#Slot-Props-Destructuring)). Optional - only needed if expecting props to be passed to the slot.
+
+- **Argument:** slot name (optional, defaults to `default`)
+
+- **Limited to:**
+ - ``
+ - [components](../guide/components-slots.html#Abbreviated-Syntax-for-Lone-Default-Slots) (for a lone default slot with props)
+
+- **Usage:**
+
+ Denote named slots or slots that expect to receive props.
+
+- **Example:**
+
+ ```html
+
+
+
+ Header content
+
+
+ Default slot content
+
+
+ Footer content
+
+
+
+
+
+
+
+ {{ slotProps.item.text }}
+
+
+
+
+
+
+ Mouse position: {{ x }}, {{ y }}
+
+ ```
+
+ For more details, see the links below.
+
+- **See also:**
+ - [Components - Slots](../guide/components-slots.html)
+ - [RFC-0001](https://github.com/vuejs/rfcs/blob/master/active-rfcs/0001-new-slot-syntax.md)
+
### v-pre
- **Does not expect expression**
@@ -2283,38 +2387,6 @@ type: api
- **See also:** [Child Component Refs](../guide/components.html#Child-Component-Refs)
-### slot
-
-- **Expects:** `string`
-
- Used on content inserted into child components to indicate which named slot the content belongs to.
-
- For detailed usage, see the guide section linked below.
-
-- **See also:** [Named Slots](../guide/components.html#Named-Slots)
-
-### slot-scope
-
-> New in 2.5.0+
-
-- **Expects:** `function argument expression`
-
-- **Usage:**
-
- Used to denote an element or component as a scoped slot. The attribute's value should be a valid JavaScript expression that can appear in the argument position of a function signature. This means in supported environments you can also use ES2015 destructuring in the expression. Serves as a replacement for [`scope`](#scope-replaced) in 2.5.0+.
-
- This attribute does not support dynamic binding.
-
-- **See also:** [Scoped Slots](../guide/components.html#Scoped-Slots)
-
-### scope replaced
-
-Used to denote a `` element as a scoped slot, which is replaced by [`slot-scope`](#slot-scope) in 2.5.0+.
-
-- **Usage:**
-
- Same as [`slot-scope`](#slot-scope) except that `scope` can only be used on `` elements.
-
### is
- **Expects:** `string | Object (component’s options object)`
@@ -2340,6 +2412,40 @@ Used to denote a `` 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 deprecated
+
+**Prefer [v-slot](#v-slot) in 2.6.0+.**
+
+- **Expects:** `string`
+
+ Used on content inserted into child components to indicate which named slot the content belongs to.
+
+- **See also:** [Named Slots with `slot`](../guide/components.html#Named-Slots-with-slot)
+
+### slot-scope deprecated
+
+**Prefer [v-slot](#v-slot) in 2.6.0+.**
+
+- **Expects:** `function argument expression`
+
+- **Usage:**
+
+ Used to denote an element or component as a scoped slot. The attribute's value should be a valid JavaScript expression that can appear in the argument position of a function signature. This means in supported environments you can also use ES2015 destructuring in the expression. Serves as a replacement for [`scope`](#scope-replaced) in 2.5.0+.
+
+ This attribute does not support dynamic binding.
+
+- **See also:** [Scoped Slots with `slot-scope`](../guide/components.html#Scoped-Slots-with-slot-scope)
+
+### scope removed
+
+**Replaced by [slot-scope](#slot-scope) in 2.5.0+. Prefer [v-slot](#v-slot) in 2.6.0+.**
+
+Used to denote a `` element as a scoped slot.
+
+- **Usage:**
+
+ Same as [`slot-scope`](#slot-scope) except that `scope` can only be used on `` elements.
+
## Built-In Components
### component
diff --git a/src/v2/guide/components-slots.md b/src/v2/guide/components-slots.md
index ffd4165a8f..cf851aa561 100644
--- a/src/v2/guide/components-slots.md
+++ b/src/v2/guide/components-slots.md
@@ -6,9 +6,11 @@ order: 104
> This page assumes you've already read the [Components Basics](components.html). Read that first if you are new to components.
+> In 2.6.0, we introduced a new unified syntax (the `v-slot` directive) for named and scoped slots. It replaces the `slot` and `slot-scope` attributes, which are now deprecated, but have _not_ been removed and are still documented [here](#Deprecated-Syntax). The rationale for introducing the new syntax is described in this [RFC](https://github.com/vuejs/rfcs/blob/master/active-rfcs/0001-new-slot-syntax.md).
+
## Slot Content
-Vue implements a content distribution API that's modeled after the current [Web Components spec draft](https://github.com/w3c/webcomponents/blob/gh-pages/proposals/Slots-Proposal.md), using the `` element to serve as distribution outlets for content.
+Vue implements a content distribution API inspired by the [Web Components spec draft](https://github.com/w3c/webcomponents/blob/gh-pages/proposals/Slots-Proposal.md), using the `` element to serve as distribution outlets for content.
This allows you to compose components like this:
@@ -29,7 +31,7 @@ Then in the template for ``, you might have:
```
-When the component renders, the `` element will be replaced by "Your Profile". Slots can contain any template code, including HTML:
+When the component renders, `` will be replaced by "Your Profile". Slots can contain any template code, including HTML:
``` html
@@ -49,11 +51,88 @@ Or even other components:
```
-If `` did **not** contain a `` element, any content passed to it would simply be discarded.
+If ``'s template did **not** contain a `` element, any content provided between its opening and closing tag would be discarded.
+
+## Compilation Scope
+
+When you want to use data inside a slot, such as in:
+
+``` html
+
+ Logged in as {{ user.name }}
+
+```
+
+That slot has access to the same instance properties (i.e. the same "scope") as the rest of the template. The slot does **not** have access to ``'s scope. For example, trying to access `url` would not work:
+
+``` html
+
+ Clicking here will send you to: {{ url }}
+
+
+```
+
+As a rule, remember that:
+
+> Everything in the parent template is compiled in parent scope; everything in the child template is compiled in the child scope.
+
+## Fallback Content
+
+There are cases when it's useful to specify fallback (i.e. default) content for a slot, to be be rendered only when no content is provided. For example, in a `` component:
+
+```html
+
+```
+
+We might want the text "Submit" to be rendered inside the `