You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/guide/components.md
+24-21Lines changed: 24 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -909,10 +909,25 @@ new Vue({
909
909
910
910
```html
911
911
<componentv-bind:is="currentView">
912
-
<!-- component changes when vm.currentview changes! -->
912
+
<!-- component changes when vm.currentView changes! -->
913
913
</component>
914
914
```
915
915
916
+
If you prefer, you can also bind directly to component objects:
917
+
918
+
```js
919
+
var Home = {
920
+
template:'<p>Welcome home!</p>'
921
+
}
922
+
923
+
newVue({
924
+
el:'body',
925
+
data: {
926
+
currentView: Home
927
+
}
928
+
})
929
+
```
930
+
916
931
### `keep-alive`
917
932
918
933
If you want to keep the switched-out components in memory so that you can preserve their state or avoid re-rendering, you can add a `keep-alive` param attribute:
@@ -923,25 +938,15 @@ If you want to keep the switched-out components in memory so that you can preser
923
938
</component>
924
939
```
925
940
926
-
### `transition-mode`
927
-
928
-
The `transition-mode` param attribute allows you to specify how the transition between two dynamic components should be executed.
929
-
930
-
By default, the transitions for incoming and outgoing components happen simultaneously. This attribute allows you to configure two other modes:
941
+
### Transitioning Components
931
942
932
-
-`in-out`: New component transitions in first, then current component transitions out after incoming transition has finished.
933
-
934
-
-`out-in`: Current component transitions out first, then new component transitions in after outgoing transition has finished.
935
-
936
-
Here's a simple example:
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:
0 commit comments