Skip to content

Commit 35d3bc5

Browse files
committed
edit keep-alive
1 parent d6df402 commit 35d3bc5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/api/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,6 +1687,8 @@ type: api
16871687

16881688
When wrapped around a dynamic component, `<keep-alive>` caches the inactive component instances without destroying them. Similar to `<transition>`, `<keep-alive>` is an abstract component: it doesn't render a DOM element itself, and doesn't show up in the component parent chain.
16891689

1690+
When a component is toggled inside `<keep-alive>`, its `activated` and `deactivated` lifecycle hooks will be invoked accordingly.
1691+
16901692
Primarily used with preserve component state or avoid re-rendering.
16911693

16921694
```html
@@ -1709,6 +1711,8 @@ type: api
17091711
</transition>
17101712
```
17111713

1714+
<p class="tip">`<keep-alive>` does not work with functional components because they do not have instances to be cached.</p>
1715+
17121716
- **See also:** [Dynamic Components - keep-alive](/guide/components.html#keep-alive)
17131717

17141718
### slot

src/guide/components.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ new Vue({
843843

844844
### `keep-alive`
845845

846-
If you want to keep the switched-out components in memory so that you can preserve their state or avoid re-rendering, you can wrap a dynamic component in a `keep-alive` element:
846+
If you want to keep the switched-out components in memory so that you can preserve their state or avoid re-rendering, you can wrap a dynamic component in a `<keep-alive>` element:
847847

848848
``` html
849849
<keep-alive>
@@ -853,6 +853,8 @@ If you want to keep the switched-out components in memory so that you can preser
853853
</keep-alive>
854854
```
855855

856+
Check out more details on `<keep-alive>` in the [API reference](/api/#keep-alive).
857+
856858
## Misc
857859

858860
### Authoring Reusable Components

0 commit comments

Comments
 (0)