Skip to content

Commit 22536d0

Browse files
sdrasbencodezenphanan
authored
docs: add in transition migration guide docs (#428)
* add in transition migration guide docs * docs: add missing word Co-authored-by: Phan An <[email protected]> * docs: add code wrapping Co-authored-by: Phan An <[email protected]> * docs: add line break Co-authored-by: Phan An <[email protected]> * docs: fix plurality Co-authored-by: Phan An <[email protected]> * docs: improve clarity of sentence * docs: increase clarity Co-authored-by: Phan An <[email protected]> Co-authored-by: Ben Hong <[email protected]> Co-authored-by: Phan An <[email protected]>
1 parent 8d4d271 commit 22536d0

File tree

2 files changed

+148
-56
lines changed

2 files changed

+148
-56
lines changed

src/.vuepress/config.js

Lines changed: 88 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
const sidebar = {
2-
cookbook: [
3-
{
4-
title: 'Cookbook',
5-
collapsable: false,
6-
children: ['/cookbook/', '/cookbook/editable-svg-icons']
7-
}
8-
],
9-
guide: [
10-
{
2+
cookbook: [{
3+
title: 'Cookbook',
4+
collapsable: false,
5+
children: ['/cookbook/', '/cookbook/editable-svg-icons']
6+
}],
7+
guide: [{
118
title: 'Essentials',
129
collapsable: false,
1310
children: [
@@ -63,8 +60,7 @@ const sidebar = {
6360
{
6461
title: 'Advanced Guides',
6562
collapsable: false,
66-
children: [
67-
{
63+
children: [{
6864
title: 'Reactivity',
6965
children: [
7066
'/guide/reactivity',
@@ -130,6 +126,7 @@ const sidebar = {
130126
'migration/keycode-modifiers',
131127
'migration/render-function-api',
132128
'migration/slots-unification',
129+
'migration/transition',
133130
'migration/v-model'
134131
]
135132
},
@@ -175,23 +172,21 @@ const sidebar = {
175172
},
176173
'/api/composition-api'
177174
],
178-
examples: [
179-
{
180-
title: 'Examples',
181-
collapsable: false,
182-
children: [
183-
'/examples/markdown',
184-
'/examples/commits',
185-
'/examples/grid-component',
186-
'/examples/tree-view',
187-
'/examples/svg',
188-
'/examples/modal',
189-
'/examples/elastic-header',
190-
'/examples/select2',
191-
'/examples/todomvc'
192-
]
193-
}
194-
]
175+
examples: [{
176+
title: 'Examples',
177+
collapsable: false,
178+
children: [
179+
'/examples/markdown',
180+
'/examples/commits',
181+
'/examples/grid-component',
182+
'/examples/tree-view',
183+
'/examples/svg',
184+
'/examples/modal',
185+
'/examples/elastic-header',
186+
'/examples/select2',
187+
'/examples/todomvc'
188+
]
189+
}]
195190
}
196191

197192
module.exports = {
@@ -201,20 +196,21 @@ module.exports = {
201196
[
202197
'link',
203198
{
204-
href:
205-
'https://fonts.googleapis.com/css?family=Inter:300,400,500,600|Open+Sans:400,600;display=swap',
199+
href: 'https://fonts.googleapis.com/css?family=Inter:300,400,500,600|Open+Sans:400,600;display=swap',
206200
rel: 'stylesheet'
207201
}
208202
],
209203
[
210204
'link',
211205
{
212-
href:
213-
'https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css',
206+
href: 'https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css',
214207
rel: 'stylesheet'
215208
}
216209
],
217-
['link', { rel: 'icon', href: '/logo.png' }],
210+
['link', {
211+
rel: 'icon',
212+
href: '/logo.png'
213+
}],
218214
[
219215
'script',
220216
{
@@ -231,37 +227,68 @@ module.exports = {
231227
],
232228
themeConfig: {
233229
logo: '/logo.png',
234-
nav: [
235-
{
230+
nav: [{
236231
text: 'Docs',
237232
ariaLabel: 'Documentation Menu',
238-
items: [
239-
{ text: 'Guide', link: '/guide/introduction' },
240-
{ text: 'Style Guide', link: '/style-guide/' },
241-
{ text: 'Cookbook', link: '/cookbook/' },
242-
{ text: 'Examples', link: '/examples/markdown' }
233+
items: [{
234+
text: 'Guide',
235+
link: '/guide/introduction'
236+
},
237+
{
238+
text: 'Style Guide',
239+
link: '/style-guide/'
240+
},
241+
{
242+
text: 'Cookbook',
243+
link: '/cookbook/'
244+
},
245+
{
246+
text: 'Examples',
247+
link: '/examples/markdown'
248+
}
243249
]
244250
},
245-
{ text: 'API Reference', link: '/api/application-config' },
251+
{
252+
text: 'API Reference',
253+
link: '/api/application-config'
254+
},
246255
{
247256
text: 'Ecosystem',
248-
items: [
249-
{
257+
items: [{
250258
text: 'Community',
251259
ariaLabel: 'Community Menu',
252-
items: [
253-
{ text: 'Team', link: '/community/team/' },
254-
{ text: 'Partners', link: '/community/partners' },
255-
{ text: 'Join', link: '/community/join/' },
256-
{ text: 'Themes', link: '/community/themes/' }
260+
items: [{
261+
text: 'Team',
262+
link: '/community/team/'
263+
},
264+
{
265+
text: 'Partners',
266+
link: '/community/partners'
267+
},
268+
{
269+
text: 'Join',
270+
link: '/community/join/'
271+
},
272+
{
273+
text: 'Themes',
274+
link: '/community/themes/'
275+
}
257276
]
258277
},
259278
{
260279
text: 'Official Projects',
261-
items: [
262-
{ text: 'Vue Router', link: 'https://router.vuejs.org/' },
263-
{ text: 'Vuex', link: 'https://vuex.vuejs.org/' },
264-
{ text: 'Vue CLI', link: 'https://cli.vuejs.org/' },
280+
items: [{
281+
text: 'Vue Router',
282+
link: 'https://router.vuejs.org/'
283+
},
284+
{
285+
text: 'Vuex',
286+
link: 'https://vuex.vuejs.org/'
287+
},
288+
{
289+
text: 'Vue CLI',
290+
link: 'https://cli.vuejs.org/'
291+
},
265292
{
266293
text: 'Vue Test Utils',
267294
link: 'https://vue-test-utils.vuejs.org/'
@@ -270,24 +297,29 @@ module.exports = {
270297
text: 'Devtools',
271298
link: 'https://github.com/vuejs/vue-devtools'
272299
},
273-
{ text: 'Weekly news', link: 'https://news.vuejs.org/' }
300+
{
301+
text: 'Weekly news',
302+
link: 'https://news.vuejs.org/'
303+
}
274304
]
275305
}
276306
]
277307
},
278308
{
279309
text: 'Support Vue',
280310
link: '/support-vuejs/',
281-
items: [
282-
{
311+
items: [{
283312
text: 'One-time Donations',
284313
link: '/support-vuejs/#one-time-donations'
285314
},
286315
{
287316
text: 'Recurring Pledges',
288317
link: '/support-vuejs/#recurring-pledges'
289318
},
290-
{ text: 'T-Shirt Shop', link: 'https://vue.threadless.com/' }
319+
{
320+
text: 'T-Shirt Shop',
321+
link: 'https://vue.threadless.com/'
322+
}
291323
]
292324
}
293325
],

src/guide/migration/transition.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
title: Transition Class Change
3+
badges:
4+
- breaking
5+
---
6+
7+
# {{ $frontmatter.title }} <MigrationBadges :badges="$frontmatter.badges" />
8+
9+
## Overview
10+
11+
The `v-enter` transition class has been renamed to `v-enter-from` and the `v-leave` transition class has been renamed to `v-leave-from`.
12+
13+
## 2.x Syntax
14+
15+
Before v2.1.8, we had two transition classes for each transition direction: initial and active states.
16+
17+
In v2.1.8, we introduced `v-enter-to` to address the timing gap between enter/leave transitions. However, for backward compatibility, the `v-enter` name was untouched:
18+
19+
```css
20+
.v-enter,
21+
.v-leave-to {
22+
opacity: 0;
23+
}
24+
25+
.v-leave,
26+
.v-enter-to {
27+
opacity: 1;
28+
}
29+
```
30+
31+
This became confusing, as _enter_ and _leave_ were broad and not using the same naming convention as their class hook counterparts.
32+
33+
## 3.x Update
34+
35+
In order to be more explicit and legible, we have now renamed these initial state classes:
36+
37+
```css
38+
.v-enter-from,
39+
.v-leave-to {
40+
opacity: 0;
41+
}
42+
43+
.v-leave-from,
44+
.v-enter-to {
45+
opacity: 1;
46+
}
47+
```
48+
49+
It's now much clearer what the difference between these states is.
50+
51+
The `<transition>` component's related prop names are also changed:
52+
53+
- `leave-class` is renamed to `leave-from-class` (can be written as `leaveFromClass` in render functions or JSX)
54+
- `enter-class` is renamed to `enter-from-class` (can be written as `enterFromClass` in render functions or JSX)
55+
56+
## Migration Strategy
57+
58+
1. Replace instances of `.v-enter` to `.v-enter-from`
59+
2. Replace instances of `.v-leave` to `.v-leave-from`
60+
3. Replace instances of related prop names, as above.

0 commit comments

Comments
 (0)