Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs for keep-alive include/exclude with array syntax #973

Merged
merged 1 commit into from
Jul 2, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/v2/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2107,8 +2107,8 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
### keep-alive

- **Props:**
- `include` - string or RegExp. Only components matched by this will be cached.
- `exclude` - string or RegExp. Any component matched by this will not be cached.
- `include` - string or RegExp or Array. Only components matched by this will be cached.
- `exclude` - string or RegExp or Array. Any component matched by this will not be cached.

- **Usage:**

Expand Down Expand Up @@ -2147,7 +2147,7 @@ All lifecycle hooks automatically have their `this` context bound to the instanc

> New in 2.1.0

The `include` and `exclude` props allow components to be conditionally cached. Both props can either be a comma-delimited string or a RegExp:
The `include` and `exclude` props allow components to be conditionally cached. Both props can be a comma-delimited string, a RegExp or an Array:

``` html
<!-- comma-delimited string -->
Expand All @@ -2159,6 +2159,11 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
<keep-alive :include="/a|b/">
<component :is="view"></component>
</keep-alive>

<!-- Array (use v-bind) -->
<keep-alive :include="['a', 'b']">
<component :is="view"></component>
</keep-alive>
```

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.
Expand Down