Skip to content

Commit ef44334

Browse files
authored
Merge pull request #56 from chenjiahan/docs_slots
docs: Add usage of slots and v-html
2 parents f62dc33 + 2fa8bc9 commit ef44334

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,34 @@ render() {
8888
}
8989
```
9090

91+
### Slots
92+
93+
named slots:
94+
95+
```jsx
96+
render() {
97+
return (
98+
<MyComponent>
99+
<header slot="header">header</header>
100+
<footer slot="footer">footer</footer>
101+
</MyComponent>
102+
)
103+
}
104+
```
105+
106+
scoped slots:
107+
108+
```jsx
109+
render() {
110+
const scopedSlots = {
111+
header: () => <header>header</header>,
112+
footer: () => <footer>footer</footer>
113+
}
114+
115+
return <MyComponent scopedSlots={scopedSlots} />
116+
}
117+
```
118+
91119
### Directives
92120

93121
```jsx
@@ -112,6 +140,12 @@ with an argument and modifiers:
112140
<input vOn:click_stop_prevent="newTodoText" />
113141
```
114142

143+
v-html:
144+
145+
```jsx
146+
<p domPropsInnerHTML={html} />
147+
```
148+
115149
### Functional Components
116150

117151
Transpiles arrow functions that return JSX into functional components, when they are either default exports:

0 commit comments

Comments
 (0)