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
Used to programmatically access [scoped slots](../guide/components.html#Scoped-Slots). For each slot, including the `default` one, the object contains a corresponding function that returns VNodes.
998
+
999
+
Accessing `vm.$scopedSlots` is most useful when writing a component with a [render function](../guide/render-function.html).
-`include` - string or RegExp. Only components matched by this will be cached.
1834
+
-`exclude` - string or RegExp. Any component matched by this will not be cached.
1835
+
1769
1836
-**用法:**
1770
1837
1771
1838
`<keep-alive>` 包裹动态组件时,会缓存不活动的组件实例,而不是销毁它们。和 `<transition>` 相似,`<keep-alive>` 是一个抽象组件:它自身不会渲染一个 DOM 元素,也不会出现在父组件链中。
@@ -1794,6 +1861,26 @@ type: api
1794
1861
</transition>
1795
1862
```
1796
1863
1864
+
-**`include` and `exclude`**
1865
+
1866
+
> New in 2.1.0
1867
+
1868
+
The `include` and `exclude` props allow components to be conditionally cached. Both props can either be a comma-delimited string or a RegExp:
1869
+
1870
+
```html
1871
+
<!-- comma-delimited string -->
1872
+
<keep-aliveinclude="a,b">
1873
+
<component:is="view"></component>
1874
+
</keep-alive>
1875
+
1876
+
<!-- regex (use v-bind) -->
1877
+
<keep-alive:include="/a|b/">
1878
+
<component:is="view"></component>
1879
+
</keep-alive>
1880
+
```
1881
+
1882
+
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.
Both Vue and React remain fast enough in development for most normal applications. However, when prototyping high frame-rate data visualizations or animations, we've seen cases of Vue handling 10 frames per second in development while React dropping to about 1 frame per second.
0 commit comments