Skip to content

Commit 1dafa6b

Browse files
Merge branch 'master' of github.com:vuejs/docs-next
2 parents f283cbb + e87d13c commit 1dafa6b

File tree

10 files changed

+105
-22
lines changed

10 files changed

+105
-22
lines changed

.github/pull_request_template.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
# ⚠️⚠️⚠️ DISCLAIMER ⚠️⚠️⚠️:
1+
## Description of Problem
22

3-
Thanks for your interest in submitting a PR! At this time, because the docs are in beta, the team is currently in the midst of changes. As a result, **we are not ready for additional contributions yet**.
3+
## Proposed Solution
44

5-
## How can I provide feedback?
6-
7-
To be respectful of your time and ideas, **please [create an issue](https://github.com/vuejs/docs-next/issues/new) instead of a pull request**. Otherwise, we will have to simply close your pull request at this time.
8-
9-
Thanks for your understanding!
5+
## Additional Information

src/.vuepress/components/BetaBanner.vue renamed to src/.vuepress/components/AppBanner.vue

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
<template>
22
<ClientOnly>
3-
<aside class="beta-banner" v-if="shouldShow">
4-
<p>
5-
<span class="hide-sm">⚠️ Beta Version:</span>
6-
Docs
7-
<span class="hide-sm">are</span> in development and subject to change.
8-
</p>
3+
<aside class="app-banner" v-if="shouldShow">
4+
<slot></slot>
95
<button ref="closeButton" @click="close">Close</button>
106
</aside>
117
</ClientOnly>
@@ -39,7 +35,7 @@ export default {
3935
<style lang="scss" scoped>
4036
@import '../theme/styles/mixins.scss';
4137
42-
.beta-banner {
38+
.app-banner {
4339
position: fixed;
4440
z-index: 21;
4541
top: 0;

src/.vuepress/components/common/vuemastery-video-modal.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<div ref="modal" class="modal" :class="{ open: isOpen }">
44
<div class="video-space" style="padding: 56.25% 0 0 0; position: relative;">
55
<iframe
6-
src="https://player.vimeo.com/video/247494684?dnt=1"
6+
src="https://player.vimeo.com/video/455611549?dnt=1"
77
style="height: 100%; left: 0; position: absolute; top: 0; width: 100%; margin: 0"
88
frameborder="0"
99
webkitallowfullscreen
@@ -23,7 +23,7 @@
2323
>Vue Mastery</a>.
2424
Watch Vue Mastery’s free
2525
<a
26-
href="https://www.vuemastery.com/courses/intro-to-vue-js/vue-instance/"
26+
href="https://www.vuemastery.com/courses/intro-to-vue-3/intro-to-vue3"
2727
target="_blank"
2828
rel="sponsored noopener"
2929
title="Vue.js Courses on Vue Mastery"

src/.vuepress/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ const sidebar = {
123123
'migration/global-api',
124124
'migration/global-api-treeshaking',
125125
'migration/inline-template-attribute',
126+
'migration/key-attribute',
126127
'migration/keycode-modifiers',
127128
'migration/render-function-api',
128129
'migration/slots-unification',

src/.vuepress/theme/layouts/Layout.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
@touchstart="onTouchStart"
66
@touchend="onTouchEnd"
77
>
8-
<BetaBanner />
98
<Navbar v-if="shouldShowNavbar" @toggle-sidebar="toggleSidebar" />
109

1110
<div class="sidebar-mask" @click="toggleSidebar(false)" />

src/guide/contributing/translations.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Vue has spread across the globe, with the core team being in at least half a doz
44

55
## Can we start translating Vue 3 docs?
66

7-
At this time, the Vue 3 docs are still in beta and subject to changes at any time. As a result, we would caution against any significant work since we are still collecting feedback and rewriting it as needed. When the docs are in release candidate phase, we will make sure to make an announcement so you can get started!
7+
Yes! We are ready for translation!
88

99
## How can I get involved with translations?
1010

11-
The best way to get started is to check out [this pinned issue for Vuejs.org](https://github.com/vuejs/vuejs.org/issues/2015) that contains active discussions on the various initiatives happening in the community.
11+
The best way to get started is to check out [this pinned issue](https://github.com/vuejs/docs-next/issues/478) that contains active discussions on the various initiatives happening in the community.

src/guide/events.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Event Handling
22

3-
<div class="vueschool"><a href="https://vueschool.io/lessons/vuejs-user-events?friend=vuejs" target="_blank" rel="sponsored noopener" title="Learn how to handle events on Vue School">Learn how to handle events in a free Vue School lesson</a></div>
4-
53
## Listening to Events
64

75
We can use the `v-on` directive, which we typically shorten to the `@` symbol, to listen to DOM events and run some JavaScript when they're triggered. The usage would be `v-on:click="methodName"` or with the shortcut, `@click="methodName"`

src/guide/installation.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
## Release Notes
44

5-
Latest beta version: 3.0.0-rc.5
5+
Latest beta version: ![beta](https://img.shields.io/npm/v/vue/next.svg)
6+
67

78
Detailed release notes for each version are available on [GitHub](https://github.com/vuejs/vue-next/releases).
89

src/guide/migration/introduction.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ The following consists a list of breaking changes from 2.x:
4242
- [Custom directive API changed to align with component lifecycle](/guide/migration/custom-directives.html)
4343
- [Some transition classes got a rename](/guide/migration/transition.md)
4444
- [Component watch option](/api/options-data.html#watch) and [instance method `$watch`](/api/instance-methods.html#watch) no longer supports dot-delimited string paths, use a computed function as the parameter instead
45+
- [Changes in `key` attribute usage with `v-if` and `<template v-for>`](/guide/migration/key-attribute.md)
4546
- In Vue 2.x, application root container's `outerHTML` is replaced with root component template (or eventually compiled to a template, if root component has no template/render option). Vue 3.x now uses application container's `innerHTML` instead.
4647

4748
### Removed

src/guide/migration/key-attribute.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
badges:
3+
- breaking
4+
---
5+
6+
# `key` attribute <MigrationBadges :badges="$frontmatter.badges" />
7+
8+
## Overview
9+
10+
- **NEW:** `key`s are no longer necessary on `v-if`/`v-else`/`v-else-if` branches, since Vue now automatically generates unique `key`s.
11+
- **BREAKING:** If you manually provide `key`s, then each branch must use a unique `key`.
12+
- **BREAKING:** `<template v-for>` `key` should be placed on the `<template>` tag (rather than on its children).
13+
14+
## Background
15+
16+
The `key` special attribute is used as a hint for Vue's virtual DOM algorithm to keep track of a node's identity. That way, Vue knows when it can reuse and patch existing nodes and when it needs to reorder or recreate them. For more information, see the following sections:
17+
18+
- [List Rendering: Maintaining State](/guide/list.html#maintaining-state)
19+
- [API Reference: `key` Special Attribute](/api/special-attributes.html#key)
20+
21+
## On conditional branches
22+
23+
In Vue 2.x, it was recommended to use `key`s on `v-if`/`v-else`/`v-else-if` branches.
24+
25+
```html
26+
<!-- Vue 2.x -->
27+
<div v-if="condition" key="yes">Yes</div>
28+
<div v-else key="no">No</div>
29+
```
30+
31+
The example above still works in Vue 3.x. However, we no longer recommend using the `key` attribute on `v-if`/`v-else`/`v-else-if` branches, since unique `key`s are now automatically generated on conditional branches if you don't provide them.
32+
33+
```html
34+
<!-- Vue 3.x -->
35+
<div v-if="condition">Yes</div>
36+
<div v-else>No</div>
37+
```
38+
39+
The breaking change is that if you manually provide `key`s, each branch must use a unique `key`. In most cases, you can remove these `key`s.
40+
41+
```html
42+
<!-- Vue 2.x -->
43+
<div v-if="condition" key="a">Yes</div>
44+
<div v-else key="a">No</div>
45+
46+
<!-- Vue 3.x (recommended solution: remove keys) -->
47+
<div v-if="condition">Yes</div>
48+
<div v-else>No</div>
49+
50+
<!-- Vue 3.x (alternate solution: make sure the keys are always unique) -->
51+
<div v-if="condition" key="a">Yes</div>
52+
<div v-else key="b">No</div>
53+
```
54+
55+
## With `<template v-for>`
56+
57+
In Vue 2.x, a `<template>` tag could not have a `key`. Instead, you could place the `key`s on each of its children.
58+
59+
```html
60+
<!-- Vue 2.x -->
61+
<template v-for="item in list">
62+
<div :key="item.id">...</div>
63+
<span :key="item.id">...</span>
64+
</template>
65+
```
66+
67+
In Vue 3.x, the `key` should be placed on the `<template>` tag instead.
68+
69+
```html
70+
<!-- Vue 3.x -->
71+
<template v-for="item in list" :key="item.id">
72+
<div>...</div>
73+
<span>...</span>
74+
</template>
75+
```
76+
77+
Similarly, when using `<template v-for>` with a child that uses `v-if`, the `key` should be moved up to the `<template>` tag.
78+
79+
```html
80+
<!-- Vue 2.x -->
81+
<template v-for="item in list">
82+
<div v-if="item.isVisible" :key="item.id">...</div>
83+
<span v-else :key="item.id">...</span>
84+
</template>
85+
86+
<!-- Vue 3.x -->
87+
<template v-for="item in list" :key="item.id">
88+
<div v-if="item.isVisible">...</div>
89+
<span v-else>...</span>
90+
</template>
91+
```

0 commit comments

Comments
 (0)