Skip to content

Commit 528c660

Browse files
fix: fixed null in render function
1 parent 5d02aad commit 528c660

File tree

2 files changed

+22
-30
lines changed

2 files changed

+22
-30
lines changed

src/api/global-api.md

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ const app = Vue.createApp(
3838
)
3939
```
4040

41-
4241
```html
4342
<div id="app">
4443
<!-- Will display 'Evan' -->
@@ -75,11 +74,11 @@ Accepts three arguments: `type`, `props` and `children`
7574
7675
#### type
7776
78-
- **Type:** `String | Object | Function | null`
77+
- **Type:** `String | Object | Function`
7978
8079
- **Details:**
8180
82-
An HTML tag name, a component, an async component or null. Using null would render a comment. This parameter is required
81+
An HTML tag name, a component or an async component. Using function returning null would render a comment. This parameter is required
8382
8483
#### props
8584
@@ -330,7 +329,7 @@ Accepts two arguments: `vnode` and `directives`.
330329

331330
- **Type:** `vnode`
332331

333-
- **Details:**
332+
- **Details:**
334333

335334
A virtual node, usually created with `h()`.
336335

@@ -340,61 +339,54 @@ Accepts two arguments: `vnode` and `directives`.
340339

341340
- **Details:**
342341

343-
An array of directives.
344-
342+
An array of directives.
343+
345344
Each directive itself is an array, which allows for up to 4 indexes to be defined as seen in the following examples.
346345

347346
- `[directive]` - The directive by itself. Required.
348347

349348
```js
350349
const MyDirective = resolveDirective('MyDirective')
351-
const nodeWithDirectives = withDirectives(
352-
h('div'),
353-
[ [MyDirective] ]
354-
)
350+
const nodeWithDirectives = withDirectives(h('div'), [[MyDirective]])
355351
```
356352

357353
- `[directive, value]` - The above, plus a value of type `any` to be assigned to the directive
358354

359355
```js
360356
const MyDirective = resolveDirective('MyDirective')
361-
const nodeWithDirectives = withDirectives(
362-
h('div'),
363-
[ [MyDirective, 100] ]
364-
)
357+
const nodeWithDirectives = withDirectives(h('div'), [[MyDirective, 100]])
365358
```
366359

367360
- `[directive, value, arg]` - The above, plus a `String` argument, ie. `click` in `v-on:click`
368361

369362
```js
370363
const MyDirective = resolveDirective('MyDirective')
371-
const nodeWithDirectives = withDirectives(
372-
h('div'),
373-
[ [MyDirective, 100, 'click'] ]
374-
)
364+
const nodeWithDirectives = withDirectives(h('div'), [
365+
[MyDirective, 100, 'click']
366+
])
375367
```
376368

377-
- `[directive, value, arg, modifiers]` - The above, plus a `key: value` pair `Object` defining any modifiers.
369+
- `[directive, value, arg, modifiers]` - The above, plus a `key: value` pair `Object` defining any modifiers.
378370

379371
```js
380372
const MyDirective = resolveDirective('MyDirective')
381-
const nodeWithDirectives = withDirectives(
382-
h('div'),
383-
[ [MyDirective, 100, 'click', { prevent: true }] ]
384-
)
373+
const nodeWithDirectives = withDirectives(h('div'), [
374+
[MyDirective, 100, 'click', { prevent: true }]
375+
])
385376
```
386377

387378
## createRenderer
388379

389380
The createRenderer function accepts two generic arguments:
390381
`HostNode` and `HostElement`, corresponding to Node and Element types in the
391-
host environment.
392-
382+
host environment.
383+
393384
For example, for runtime-dom, HostNode would be the DOM
394385
`Node` interface and HostElement would be the DOM `Element` interface.
395-
386+
396387
Custom renderers can pass in the platform specific types like this:
397-
``` js
388+
389+
```js
398390
import { createRenderer } from 'vue'
399391
const { render, createApp } = createRenderer<Node, Element>({
400392
patchProp,

src/guide/render-function.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ The `h()` function is a utility to create VNodes. It could perhaps more accurate
134134
```js
135135
// @returns {VNode}
136136
h(
137-
// {String | Object | Function | null} tag
138-
// An HTML tag name, a component, an async component or null.
139-
// Using null would render a comment.
137+
// {String | Object | Function } tag
138+
// An HTML tag name, a component or an async component.
139+
// Using function returning null would render a comment.
140140
//
141141
// Required.
142142
'div',

0 commit comments

Comments
 (0)