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/api/index.md
+31-26Lines changed: 31 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -902,42 +902,47 @@ type: api
902
902
903
903
-**Details:**
904
904
905
-
A hash of VNode children of component that should resolve with slot. VNode children resolved with Single Slot are stored as the `default` key. VNode children resolve with Named Slot are stored as the key that specified with `slot` attribute. those VNode children are stored an Array.
905
+
Used to access content [distributed by slots](/guide/components.html#Content-Distribution-with-Slots). Each [named slot](/guide/components.html#Named-Slots) has its own corresponding property (e.g. the contents of `slot="foo"` will be found at `vm.$slots.foo`). The `default` property contains any nodes not included in a named slot.
906
+
907
+
Accessing `vm.$slots` is most useful when writing a component with a [render function](/guide/render-function.html).
906
908
907
909
-**Example:**
908
910
909
911
```html
910
-
<divid="slots-demo">
911
-
...
912
-
<my-component1>
913
-
<pslot="slot1">named slot content1</p>
914
-
<div>single slot content</div>
915
-
<pslot="slot2">named slot content2</div></p>
916
-
</my-component1>
917
-
...
918
-
</div>
912
+
<blog-post>
913
+
<h1slot="header">
914
+
About Me
915
+
</h1>
916
+
917
+
<p>Here's some page content, which will be included in vm.$slots.default, because it's not inside a named slot.</p>
918
+
919
+
<pslot="footer">
920
+
Copyright 2016 Evan You
921
+
</p>
922
+
923
+
<p>If I have some content down here, it will also be included in vm.$slots.default.</p>.
0 commit comments