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

Function createComponent

static/vuejs/vue.esm.js:2972–3055  ·  view source on GitHub ↗
(
  Ctor,
  data,
  context,
  children,
  tag
)

Source from the content-addressed store, hash-verified

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