Skip to content

Commit 2a9946d

Browse files
jkzingkazupon
authored andcommitted
update keep-alive api with array syntax (#973)
1 parent 640f418 commit 2a9946d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Diff for: src/v2/api/index.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -2107,8 +2107,8 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
21072107
### keep-alive
21082108
21092109
- **Props:**
2110-
- `include` - string or RegExp. Only components matched by this will be cached.
2111-
- `exclude` - string or RegExp. Any component matched by this will not be cached.
2110+
- `include` - string or RegExp or Array. Only components matched by this will be cached.
2111+
- `exclude` - string or RegExp or Array. Any component matched by this will not be cached.
21122112
21132113
- **Usage:**
21142114
@@ -2147,7 +2147,7 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
21472147
21482148
> New in 2.1.0
21492149
2150-
The `include` and `exclude` props allow components to be conditionally cached. Both props can either be a comma-delimited string or a RegExp:
2150+
The `include` and `exclude` props allow components to be conditionally cached. Both props can be a comma-delimited string, a RegExp or an Array:
21512151
21522152
``` html
21532153
<!-- comma-delimited string -->
@@ -2159,6 +2159,11 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
21592159
<keep-alive :include="/a|b/">
21602160
<component :is="view"></component>
21612161
</keep-alive>
2162+
2163+
<!-- Array (use v-bind) -->
2164+
<keep-alive :include="['a', 'b']">
2165+
<component :is="view"></component>
2166+
</keep-alive>
21622167
```
21632168
21642169
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.

0 commit comments

Comments
 (0)