|
2 | 2 |
|
3 | 3 | Built-in components can be used directly in templates without needing to be registered.
|
4 | 4 |
|
5 |
| -The `<keep-alive>`, `<transition>`, `<transition-group>`, and `<teleport>` components can all be tree-shaken by bundlers, so that they are only included in the build if they're used. They can also be imported explicitly if you need direct access to the component itself: |
| 5 | +The `<Transition>`, `<TransitionGroup>`, `<KeepAlive>`, `<Teleport>` and `<Suspense>` components can all be tree-shaken by bundlers, so that they are only included in the build if they're used.They can also be imported explicitly if you need direct access to the component itself: |
6 | 6 |
|
7 | 7 | ```js
|
8 |
| -// CDN build of Vue |
9 |
| -const { KeepAlive, Teleport, Transition, TransitionGroup } = Vue |
| 8 | +// ESM build of Vue |
| 9 | +import { Transition, TransitionGroup, KeepAlive, Teleport, Suspense } from 'vue' |
10 | 10 | ```
|
11 | 11 |
|
12 | 12 | ```js
|
13 |
| -// ESM build of Vue |
14 |
| -import { KeepAlive, Teleport, Transition, TransitionGroup } from 'vue' |
| 13 | +// CDN build of Vue |
| 14 | +const { Transition, TransitionGroup, KeepAlive, Teleport, Suspense } = Vue |
15 | 15 | ```
|
16 | 16 |
|
17 |
| -`<component>` and `<slot>` are component-like features of template syntax. They are not true components and they can't be imported like the components shown above. |
18 |
| - |
19 |
| -## component |
20 |
| - |
21 |
| -- **Props:** |
22 |
| - |
23 |
| - - `is` - `string | Component` |
24 |
| - |
25 |
| -- **Usage:** |
26 |
| - |
27 |
| - A "meta component" for rendering dynamic components. The actual component to render is determined by the `is` prop. An `is` prop as a string could be either an HTML tag name or a Component name. |
28 |
| - |
29 |
| - ```vue-html |
30 |
| - <!-- a dynamic component controlled by --> |
31 |
| - <!-- the `componentId` property on the vm --> |
32 |
| - <component :is="componentId"></component> |
33 |
| -
|
34 |
| - <!-- can also render registered component or component passed as prop --> |
35 |
| - <component :is="$options.components.child"></component> |
36 |
| -
|
37 |
| - <!-- can reference components by string --> |
38 |
| - <component :is="condition ? 'FooComponent' : 'BarComponent'"></component> |
39 |
| -
|
40 |
| - <!-- can be used to render native HTML elements --> |
41 |
| - <component :is="href ? 'a' : 'span'"></component> |
42 |
| - ``` |
43 |
| - |
44 |
| - The built-in components `KeepAlive`, `Transition`, `TransitionGroup`, and `Teleport` can all be passed to `is`, but you must register them if you want to pass them by name. For example: |
45 |
| - |
46 |
| - ```js |
47 |
| - const { Transition, TransitionGroup } = Vue |
48 |
| - |
49 |
| - const Component = { |
50 |
| - components: { |
51 |
| - Transition, |
52 |
| - TransitionGroup |
53 |
| - }, |
54 |
| - |
55 |
| - template: ` |
56 |
| - <component :is="isGroup ? 'TransitionGroup' : 'Transition'"> |
57 |
| - ... |
58 |
| - </component> |
59 |
| - ` |
60 |
| - } |
61 |
| - ``` |
62 |
| - |
63 |
| - Registration is not required if you pass the component itself to `is` rather than its name. |
64 |
| - |
65 |
| -- **See also:** [Dynamic Components](/guide/essentials/component-basics.html#dynamic-components) |
66 |
| - |
67 |
| -## transition |
| 17 | +## `<Transition>` |
68 | 18 |
|
69 | 19 | - **Props:**
|
70 | 20 |
|
@@ -138,7 +88,7 @@ import { KeepAlive, Teleport, Transition, TransitionGroup } from 'vue'
|
138 | 88 |
|
139 | 89 | - **See also:** [Enter & Leave Transitions](/guide/built-ins/transitions-enterleave.html#transitioning-single-elements-components)
|
140 | 90 |
|
141 |
| -## transition-group |
| 91 | +## `<TransitionGroup>` |
142 | 92 |
|
143 | 93 | - **Props:**
|
144 | 94 |
|
@@ -168,7 +118,7 @@ import { KeepAlive, Teleport, Transition, TransitionGroup } from 'vue'
|
168 | 118 |
|
169 | 119 | - **See also:** [List Transitions](/guide/built-ins/transitions-list.html)
|
170 | 120 |
|
171 |
| -## keep-alive |
| 121 | +## `<KeepAlive>` |
172 | 122 |
|
173 | 123 | - **Props:**
|
174 | 124 |
|
@@ -245,21 +195,7 @@ import { KeepAlive, Teleport, Transition, TransitionGroup } from 'vue'
|
245 | 195 |
|
246 | 196 | - **See also:** [`<KeepAlive/>`](/guide/built-ins/keep-alive.html)
|
247 | 197 |
|
248 |
| -## slot |
249 |
| - |
250 |
| -- **Props:** |
251 |
| - |
252 |
| - - `name` - `string`, Used for named slot. |
253 |
| - |
254 |
| -- **Usage:** |
255 |
| - |
256 |
| - `<slot>` serve as content distribution outlets in component templates. `<slot>` itself will be replaced. |
257 |
| - |
258 |
| - For detailed usage, see the guide section linked below. |
259 |
| - |
260 |
| -- **See also:** [Content Distribution with Slots](/guide/essentials/component-basics.html#content-distribution-with-slots) |
261 |
| - |
262 |
| -## teleport |
| 198 | +## `<Teleport>` |
263 | 199 |
|
264 | 200 | - **Props:**
|
265 | 201 |
|
@@ -287,3 +223,7 @@ import { KeepAlive, Teleport, Transition, TransitionGroup } from 'vue'
|
287 | 223 | Notice that this will move the actual DOM nodes instead of being destroyed and recreated, and it will keep any component instances alive as well. All stateful HTML elements (i.e. a playing video) will keep their state.
|
288 | 224 |
|
289 | 225 | - **See also:** [Teleport component](/guide/built-ins/teleport.html#teleport)
|
| 226 | + |
| 227 | +## `<Suspense>` |
| 228 | + |
| 229 | +// TODO |
0 commit comments