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

Function compatH

packages/runtime-core/src/compat/renderFn.ts:122–173  ·  view source on GitHub ↗
(
  type: any,
  propsOrChildren?: any,
  children?: any,
)

Source from the content-addressed store, hash-verified

120): VNode
121
122export function compatH(
123 type: any,
124 propsOrChildren?: any,
125 children?: any,
126): VNode {
127 if (!type) {
128 type = Comment
129 }
130
131 // to support v2 string component name look!up
132 if (typeof type === 'string') {
133 const t = hyphenate(type)
134 if (t === 'transition' || t === 'transition-group' || t === 'keep-alive') {
135 // since transition and transition-group are runtime-dom-specific,
136 // we cannot import them directly here. Instead they are registered using
137 // special keys in @vue/compat entry.
138 type = `__compat__${t}`
139 }
140 type = resolveDynamicComponent(type)
141 }
142
143 const l = arguments.length
144 const is2ndArgArrayChildren = isArray(propsOrChildren)
145 if (l === 2 || is2ndArgArrayChildren) {
146 if (isObject(propsOrChildren) && !is2ndArgArrayChildren) {
147 // single vnode without props
148 if (isVNode(propsOrChildren)) {
149 return convertLegacySlots(createVNode(type, null, [propsOrChildren]))
150 }
151 // props without children
152 return convertLegacySlots(
153 convertLegacyDirectives(
154 createVNode(type, convertLegacyProps(propsOrChildren, type)),
155 propsOrChildren,
156 ),
157 )
158 } else {
159 // omit props
160 return convertLegacySlots(createVNode(type, null, propsOrChildren))
161 }
162 } else {
163 if (isVNode(children)) {
164 children = [children]
165 }
166 return convertLegacySlots(
167 convertLegacyDirectives(
168 createVNode(type, convertLegacyProps(propsOrChildren, type), children),
169 propsOrChildren,
170 ),
171 )
172 }
173}
174
175const skipLegacyRootLevelProps = /*@__PURE__*/ makeMap(
176 'staticStyle,staticClass,directives,model,hook',

Callers

nothing calls this directly

Calls 6

resolveDynamicComponentFunction · 0.90
isObjectFunction · 0.90
isVNodeFunction · 0.90
convertLegacySlotsFunction · 0.85
convertLegacyDirectivesFunction · 0.85
convertLegacyPropsFunction · 0.85

Tested by

no test coverage detected