MCPcopy Create free account
hub / github.com/TruthHun/BookStack / createComponent

Function createComponent

static/vuejs/vue.runtime.common.js:2970–3053  ·  view source on GitHub ↗
(
  Ctor,
  data,
  context,
  children,
  tag
)

Source from the content-addressed store, hash-verified

2968var hooksToMerge = Object.keys(componentVNodeHooks);
2969
2970function createComponent (
2971 Ctor,
2972 data,
2973 context,
2974 children,
2975 tag
2976) {
2977 if (!Ctor) {
2978 return
2979 }
2980
2981 var baseCtor = context.$options._base;
2982 if (isObject(Ctor)) {
2983 Ctor = baseCtor.extend(Ctor);
2984 }
2985
2986 if (typeof Ctor !== 'function') {
2987 if (process.env.NODE_ENV !== 'production') {
2988 warn(("Invalid Component definition: " + (String(Ctor))), context);
2989 }
2990 return
2991 }
2992
2993 // async component
2994 if (!Ctor.cid) {
2995 if (Ctor.resolved) {
2996 Ctor = Ctor.resolved;
2997 } else {
2998 Ctor = resolveAsyncComponent(Ctor, baseCtor, function () {
2999 // it's ok to queue this on every render because
3000 // $forceUpdate is buffered by the scheduler.
3001 context.$forceUpdate();
3002 });
3003 if (!Ctor) {
3004 // return nothing if this is indeed an async component
3005 // wait for the callback to trigger parent update.
3006 return
3007 }
3008 }
3009 }
3010
3011 // resolve constructor options in case global mixins are applied after
3012 // component constructor creation
3013 resolveConstructorOptions(Ctor);
3014
3015 data = data || {};
3016
3017 // transform component v-model data into props & events
3018 if (data.model) {
3019 transformModel(Ctor.options, data);
3020 }
3021
3022 // extract props
3023 var propsData = extractProps(data, Ctor, tag);
3024
3025 // functional component
3026 if (Ctor.options.functional) {
3027 return createFunctionalComponent(Ctor, propsData, data, context, children)

Callers 2

_createElementFunction · 0.70
createElmFunction · 0.70

Calls 14

extendMethod · 0.80
isObjectFunction · 0.70
resolveAsyncComponentFunction · 0.70
transformModelFunction · 0.70
extractPropsFunction · 0.70
mergeHooksFunction · 0.70
isDefFunction · 0.70
iFunction · 0.70
initComponentFunction · 0.70
isTrueFunction · 0.70

Tested by

no test coverage detected