Skip to content

Commit 65a775b

Browse files
chrisvfritzyyx990803
authored andcommitted
reorganize guide into 3 sections
1 parent 31a9b42 commit 65a775b

File tree

4 files changed

+87
-63
lines changed

4 files changed

+87
-63
lines changed

src/guide/components.md

Lines changed: 2 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Components
33
type: guide
4-
order: 13
4+
order: 11
55
---
66

77
## What are Components?
@@ -89,7 +89,7 @@ new Vue({
8989
})
9090
```
9191

92-
The same encapsulation applies for other registerable Vue features, such as directives and transitions.
92+
The same encapsulation applies for other registerable Vue features, such as directives.
9393

9494
### Component Option Caveats
9595

@@ -938,60 +938,6 @@ If you want to keep the switched-out components in memory so that you can preser
938938
</component>
939939
```
940940

941-
### Transitioning Components
942-
943-
Just as we did [with elements](transitions.html#Transitioning-Between-Elements), we can transition between components, but we don't need the `key` attribute:
944-
945-
``` html
946-
<!-- fade out first, then fade in -->
947-
<transition name="fade" mode="out-in">
948-
<component v-bind:is="view"></component>
949-
</transition>
950-
```
951-
952-
``` css
953-
.fade-enter-active, .fade-leave-active {
954-
transition: opacity .3s ease;
955-
}
956-
.fade-enter, .fade-leave-active {
957-
opacity: 0;
958-
}
959-
```
960-
961-
{% raw %}
962-
<div id="transition-mode-demo" class="demo">
963-
<input v-model="view" type="radio" value="v-a" id="a" name="view"><label for="a">A</label>
964-
<input v-model="view" type="radio" value="v-b" id="b" name="view"><label for="b">B</label>
965-
<transition name="fade" mode="out-in">
966-
<component v-bind:is="view"></component>
967-
</transition>
968-
</div>
969-
<style>
970-
.fade-enter-active, .fade-leave-active {
971-
transition: opacity .3s ease;
972-
}
973-
.fade-enter, .fade-leave-active {
974-
opacity: 0;
975-
}
976-
</style>
977-
<script>
978-
new Vue({
979-
el: '#transition-mode-demo',
980-
data: {
981-
view: 'v-a'
982-
},
983-
components: {
984-
'v-a': {
985-
template: '<div>Component A</div>'
986-
},
987-
'v-b': {
988-
template: '<div>Component B</div>'
989-
}
990-
}
991-
})
992-
</script>
993-
{% endraw %}
994-
995941
## Misc
996942

997943
### Components and v-for

src/guide/transitioning-state.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Transitioning State
33
type: guide
4-
order: 12
4+
order: 13
55
---
66

77
Vue's transition system offers many simple ways to animate entering, leaving, and lists, but what about animating your data itself? For example:

src/guide/transitions.md

Lines changed: 74 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: 'Transitions: Entering, Leaving, and Lists'
33
type: guide
4-
order: 11
4+
order: 12
55
---
66

77
## Overview
@@ -21,7 +21,7 @@ Vue provides a `transition` wrapper component, allowing you to add entering/leav
2121

2222
- Conditional rendering (using `v-if`)
2323
- Conditional display (using `v-show`)
24-
- Dynamic components (introduced in the [next section](components.html#Dynamic-Components))
24+
- Dynamic components
2525
- Component root nodes
2626

2727
This is what a very simple example looks like in action:
@@ -592,7 +592,7 @@ and custom JavaScript hooks:
592592

593593
## Transitioning Between Elements
594594

595-
We discuss [transitioning between components](components.html#Dynamic-Components) later, but you can also transition between raw elements using `v-if`/`v-else`. One of the most common two-element transitions is between a list container and a message describing an empty list:
595+
We discuss [transitioning between components](#Transitioning-Between-Components) later, but you can also transition between raw elements using `v-if`/`v-else`. One of the most common two-element transitions is between a list container and a message describing an empty list:
596596

597597
``` html
598598
<transition>
@@ -883,6 +883,76 @@ new Vue({
883883

884884
Pretty cool, right?
885885

886+
## Transitioning Between Components
887+
888+
Transitioning between components is even simpler - we don't even need the `key` attribute. Instead, we just wrap a [dynamic component](components.html#Dynamic-Components):
889+
890+
``` html
891+
<transition name="component-fade" mode="out-in">
892+
<component v-bind:is="view"></component>
893+
</transition>
894+
```
895+
896+
``` js
897+
new Vue({
898+
el: '#transition-components-demo',
899+
data: {
900+
view: 'v-a'
901+
},
902+
components: {
903+
'v-a': {
904+
template: '<div>Component A</div>'
905+
},
906+
'v-b': {
907+
template: '<div>Component B</div>'
908+
}
909+
}
910+
})
911+
```
912+
913+
``` css
914+
.component-fade-enter-active, .component-fade-leave-active {
915+
transition: opacity .3s ease;
916+
}
917+
.component-fade-enter, .component-fade-leave-active {
918+
opacity: 0;
919+
}
920+
```
921+
922+
{% raw %}
923+
<div id="transition-components-demo" class="demo">
924+
<input v-model="view" type="radio" value="v-a" id="a" name="view"><label for="a">A</label>
925+
<input v-model="view" type="radio" value="v-b" id="b" name="view"><label for="b">B</label>
926+
<transition name="component-fade" mode="out-in">
927+
<component v-bind:is="view"></component>
928+
</transition>
929+
</div>
930+
<style>
931+
.component-fade-enter-active, .component-fade-leave-active {
932+
transition: opacity .3s ease;
933+
}
934+
.component-fade-enter, .component-fade-leave-active {
935+
opacity: 0;
936+
}
937+
</style>
938+
<script>
939+
new Vue({
940+
el: '#transition-components-demo',
941+
data: {
942+
view: 'v-a'
943+
},
944+
components: {
945+
'v-a': {
946+
template: '<div>Component A</div>'
947+
},
948+
'v-b': {
949+
template: '<div>Component B</div>'
950+
}
951+
}
952+
})
953+
</script>
954+
{% endraw %}
955+
886956
## List Transitions
887957

888958
So far, we've managed transitions for:
@@ -1388,9 +1458,7 @@ new Vue({
13881458

13891459
## Reusable Transitions
13901460

1391-
Transitions can be reused through Vue's component system. If you aren't yet familiar with it, you should read [the components guide](components.html) now before continuing with the rest of this document.
1392-
1393-
OK, I'll assume you're familiar with components now. To create a reusable transition, all you have to do is place a `<transition>` or `<transition-group>` component at the root, then pass any children into the transition component.
1461+
Transitions can be reused through Vue's component system. To create a reusable transition, all you have to do is place a `<transition>` or `<transition-group>` component at the root, then pass any children into the transition component.
13941462

13951463
Here's an example using a template component:
13961464

themes/vue/layout/partials/sidebar.ejs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@
2020
</h2>
2121
<ul class="menu-root">
2222
<% type !== 'api' && site.pages.find({type: type}).sort('order').each(function (p) { %>
23+
<% var fileName = p.path.replace(/^.+?\/([\w-]+)\.html/, '$1') %>
24+
<% if (fileName === 'installation') { %>
25+
<li><h3>Essentials</h3></li>
26+
<% } %>
27+
<% if (fileName === 'transitions') { %>
28+
<li><h3>Advanced</h3></li>
29+
<% } %>
30+
<% if (fileName === 'comparison') { %>
31+
<li><h3>Meta</h3></li>
32+
<% } %>
2333
<li>
2434
<a href="/<%- p.path %>" class="sidebar-link<%- page.title === p.title ? ' current' : '' %><%- p.is_new ? ' new' : '' %>"><%- p.title %></a>
2535
</li>

0 commit comments

Comments
 (0)