diff --git a/src/.vuepress/config.js b/src/.vuepress/config.js index a09680d392..46b39821cb 100644 --- a/src/.vuepress/config.js +++ b/src/.vuepress/config.js @@ -94,6 +94,7 @@ const sidebar = { 'migration/functional-components', 'migration/async-components', 'migration/custom-directives', + 'migration/fragments', 'migration/render-function-api', 'migration/slots-unification', 'migration/keycode-modifiers' diff --git a/src/guide/component-props.md b/src/guide/component-props.md index d5f0b2262a..e1b0c921b7 100644 --- a/src/guide/component-props.md +++ b/src/guide/component-props.md @@ -324,7 +324,7 @@ app.component('custom-layout', { template: `
...
...
- + ` }) ``` diff --git a/src/guide/migration/fragments.md b/src/guide/migration/fragments.md new file mode 100644 index 0000000000..b6490ea95b --- /dev/null +++ b/src/guide/migration/fragments.md @@ -0,0 +1,35 @@ +# Fragments + +## Overview + +In Vue 3, components now have official support for multi-root node components, i.e., fragments! + +## Previous Syntax + +In 2.x, multi-root components were not supported and would emit a warning when a user accidentally created one. As a result, many components are wrapped in a single `
` in order to fix this error. + +```html + + +``` + +## Current Syntax + +In 3.x, components now can have multiple root nodes! However, this does require developers to explicitly define where attributes should be distributed. + +```html + + +``` + +For more information on how attribute inheritance works, see [Non-Prop Attributes](/guide/component-props.html#disabling-attribute-inheritance). diff --git a/src/guide/migration/introduction.md b/src/guide/migration/introduction.md index dfb67ef143..91322fb8cf 100644 --- a/src/guide/migration/introduction.md +++ b/src/guide/migration/introduction.md @@ -8,6 +8,24 @@ We're glad you asked! The answer is no. We've gone to great lengths to ensure mo Possibly the biggest change is our new Composition API, which is entirely additive- the previous Options API will continue to be supported, as the Composition API is an advanced feature. +## Overview + +### New Features + +Some of the new features to keep an eye on in Vue 3 include: + +- [Composition API](/guide/composition-api-introduction.html) +- [Teleport](/guide/teleport) +- [Fragments](/guide/migration/fragments) +- [Emits Component Option](/guide/component-custom-events.html) +- `createRenderer` API from `@vue/runtime-core` to create custom renderers + +### Breaking + +The following consists a list of breaking changes from v2: + +- **keyCode support as `v-on` modifiers.** For more information, [see in-depth explanation](/guides/migration/keycodes.html) + ## FAQ > Where should I start in a migration? @@ -37,21 +55,3 @@ It depends on a few factors: > If I upgrade to Vue 3, will I also have to upgrade Vuex and Vue Router? [//]: # 'TODO: still need to see where this lands' - -## Overview - -### New Features - -Some of the new features to keep an eye on in Vue 3 include: - -- [Composition API](/guide/composition-api-introduction.html) -- [Teleport](/guide/teleport) -- Fragments -- [Emits Component Option](/guide/component-custom-events.html) -- `createRenderer` API from `@vue/runtime-core` to create custom renderers - -### Breaking - -The following consists a list of breaking changes from v2: - -- **keyCode support as `v-on` modifiers.** For more information, [see in-depth explanation](/guides/migration/keycodes.html)