Skip to content

Commit dbeed5b

Browse files
fix: correct two examples of using h with components and slots (#681)
1 parent af5b09f commit dbeed5b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/guide/render-function.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,11 +370,15 @@ To pass slots to a child component using render functions:
370370
render() {
371371
// `<div><child v-slot="props"><span>{{ props.text }}</span></child></div>`
372372
return Vue.h('div', [
373-
Vue.h('child', {}, {
373+
Vue.h(
374+
Vue.resolveComponent('child'),
375+
{},
374376
// pass `slots` as the children object
375377
// in the form of { name: props => VNode | Array<VNode> }
376-
default: (props) => Vue.h('span', props.text)
377-
})
378+
{
379+
default: (props) => Vue.h('span', props.text)
380+
}
381+
)
378382
])
379383
}
380384
```
@@ -389,7 +393,9 @@ Vue.h(
389393
{
390394
level: 1
391395
},
392-
[Vue.h('span', 'Hello'), ' world!']
396+
{
397+
default: () => [Vue.h('span', 'Hello'), ' world!']
398+
}
393399
)
394400
```
395401

0 commit comments

Comments
 (0)