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/v2/api/index.md
+17-4Lines changed: 17 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -361,7 +361,7 @@ type: api
361
361
-**Usage:**
362
362
363
363
Install a Vue.js plugin. If the plugin is an Object, it must expose an `install` method. If it is a function itself, it will be treated as the install method. The install method will be called with Vue as the argument.
364
-
364
+
365
365
This method has to be called before calling `new Vue()`
366
366
367
367
When this method is called on the same plugin multiple times, the plugin will be installed only once.
@@ -2452,8 +2452,9 @@ Used to denote a `<template>` element as a scoped slot, which is replaced by [`s
2452
2452
### keep-alive
2453
2453
2454
2454
- **Props:**
2455
-
- `include` - string or RegExp or Array. Only components matched by this will be cached.
2456
-
- `exclude` - string or RegExp or Array. Any component matched by this will not be cached.
2455
+
- `include` - string or RegExp or Array. Only components with matching names will be cached.
2456
+
- `exclude` - string or RegExp or Array. Any component with a matching name will not be cached.
2457
+
- `max` - number. The maximum number of component instances to cache.
2457
2458
2458
2459
- **Usage:**
2459
2460
@@ -2512,7 +2513,19 @@ Used to denote a `<template>` element as a scoped slot, which is replaced by [`s
2512
2513
2513
2514
The match is first checked on the component's own `name` option, then its local registration name (the key in the parent's `components` option) if the `name` option is not available. Anonymous components cannot be matched against.
2514
2515
2515
-
<p class="tip">`<keep-alive>` does not work with functional components because they do not have instances to be cached.</p>
2516
+
- **`max`**
2517
+
2518
+
> New in 2.5.0+
2519
+
2520
+
The maximum number of component instances to cache. Once this number is reached, the cached component instance that was least recently accessed will be destroyed before creating a new instance.
2521
+
2522
+
``` html
2523
+
<keep-alive :max="10">
2524
+
<component :is="view"></component>
2525
+
</keep-alive>
2526
+
```
2527
+
2528
+
<p class="tip">`<keep-alive>` does not work with functional components because they do not have instances to be cached.</p>
0 commit comments