MCPcopy
hub / github.com/fanmingming/live / createComponent

Function createComponent

m3u8/vue.js:3175–3272  ·  view source on GitHub ↗
(
    Ctor,
    data,
    context,
    children,
    tag
  )

Source from the content-addressed store, hash-verified

3173 var hooksToMerge = Object.keys(componentVNodeHooks);
3174
3175 function createComponent (
3176 Ctor,
3177 data,
3178 context,
3179 children,
3180 tag
3181 ) {
3182 if (isUndef(Ctor)) {
3183 return
3184 }
3185
3186 var baseCtor = context.$options._base;
3187
3188 // plain options object: turn it into a constructor
3189 if (isObject(Ctor)) {
3190 Ctor = baseCtor.extend(Ctor);
3191 }
3192
3193 // if at this stage it's not a constructor or an async component factory,
3194 // reject.
3195 if (typeof Ctor !== 'function') {
3196 {
3197 warn(("Invalid Component definition: " + (String(Ctor))), context);
3198 }
3199 return
3200 }
3201
3202 // async component
3203 var asyncFactory;
3204 if (isUndef(Ctor.cid)) {
3205 asyncFactory = Ctor;
3206 Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
3207 if (Ctor === undefined) {
3208 // return a placeholder node for async component, which is rendered
3209 // as a comment node but preserves all the raw information for the node.
3210 // the information will be used for async server-rendering and hydration.
3211 return createAsyncPlaceholder(
3212 asyncFactory,
3213 data,
3214 context,
3215 children,
3216 tag
3217 )
3218 }
3219 }
3220
3221 data = data || {};
3222
3223 // resolve constructor options in case global mixins are applied after
3224 // component constructor creation
3225 resolveConstructorOptions(Ctor);
3226
3227 // transform component v-model data into props & events
3228 if (isDef(data.model)) {
3229 transformModel(Ctor.options, data);
3230 }
3231
3232 // extract props

Callers 2

_createElementFunction · 0.85
createElmFunction · 0.85

Calls 15

isUndefFunction · 0.85
isObjectFunction · 0.85
warnFunction · 0.85
resolveAsyncComponentFunction · 0.85
createAsyncPlaceholderFunction · 0.85
isDefFunction · 0.85
transformModelFunction · 0.85
isTrueFunction · 0.85
installComponentHooksFunction · 0.85

Tested by

no test coverage detected