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: README.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,7 @@
19
19
-[Styles](#styles)
20
20
-[Template Binding](#template-binding)
21
21
-[Child Components](#child-components)
22
+
-[Custom Properties](#custom-properties)
22
23
23
24
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
24
25
@@ -310,3 +311,20 @@ Then using the custom elements in the template:
310
311
```
311
312
312
313
Also pull out all the cards to a Category component.
314
+
315
+
### Custom Properties
316
+
317
+
In previous module, we created static child components. Want to create dynamic child components, pass in data to them.
318
+
One way to do this is with *custom properties*. Example [Post.vue](src/theme/Post.vue).
319
+
320
+
Use `props` property. This is an array that binds the property of the component with attribute of the element.
321
+
322
+

323
+
324
+
Move card snippet to Post component. Now it needs data passed in to it. This is done by binding the custom `<app-post>` element with the `post` json data, via `props`:
325
+
326
+
```html
327
+
<divclass="column is-one-third"v-for="(post, title) in posts"v-bind:key="post.id">
0 commit comments