MCPcopy
hub / github.com/vuejs/core / h

Function h

packages/runtime-core/src/h.ts:204–232  ·  view source on GitHub ↗
(type: any, propsOrChildren?: any, children?: any)

Source from the content-addressed store, hash-verified

202
203// Actual implementation
204export function h(type: any, propsOrChildren?: any, children?: any): VNode {
205 try {
206 // #6913 disable tracking block in h function
207 setBlockTracking(-1)
208 const l = arguments.length
209 if (l === 2) {
210 if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
211 // single vnode without props
212 if (isVNode(propsOrChildren)) {
213 return createVNode(type, null, [propsOrChildren])
214 }
215 // props without children
216 return createVNode(type, propsOrChildren)
217 } else {
218 // omit props
219 return createVNode(type, null, propsOrChildren)
220 }
221 } else {
222 if (l > 3) {
223 children = Array.prototype.slice.call(arguments, 2)
224 } else if (l === 3 && isVNode(children)) {
225 children = [children]
226 }
227 return createVNode(type, propsOrChildren, children)
228 }
229 } finally {
230 setBlockTracking(1)
231 }
232}

Callers 15

global.spec.tsFile · 0.90
misc.spec.tsFile · 0.90
Transition.tsFile · 0.90
callHookFunction · 0.90
renderFunction · 0.90
setupFunction · 0.90
BazFunction · 0.90
WBazFunction · 0.90
patchProps.spec.tsFile · 0.90
setupFunction · 0.90

Calls 3

setBlockTrackingFunction · 0.90
isObjectFunction · 0.90
isVNodeFunction · 0.90

Tested by 15

renderFunction · 0.72
setupFunction · 0.72
BazFunction · 0.72
WBazFunction · 0.72
setupFunction · 0.72
renderFunction · 0.72
renderFunction · 0.72
setupFunction · 0.72
setupFunction · 0.72
renderFunction · 0.72
renderFunction · 0.72
renderFunction · 0.72