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

Function createFunctionalComponent

m3u8/vue.js:3037–3076  ·  view source on GitHub ↗
(
    Ctor,
    propsData,
    data,
    contextVm,
    children
  )

Source from the content-addressed store, hash-verified

3035 installRenderHelpers(FunctionalRenderContext.prototype);
3036
3037 function createFunctionalComponent (
3038 Ctor,
3039 propsData,
3040 data,
3041 contextVm,
3042 children
3043 ) {
3044 var options = Ctor.options;
3045 var props = {};
3046 var propOptions = options.props;
3047 if (isDef(propOptions)) {
3048 for (var key in propOptions) {
3049 props[key] = validateProp(key, propOptions, propsData || emptyObject);
3050 }
3051 } else {
3052 if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
3053 if (isDef(data.props)) { mergeProps(props, data.props); }
3054 }
3055
3056 var renderContext = new FunctionalRenderContext(
3057 data,
3058 props,
3059 children,
3060 contextVm,
3061 Ctor
3062 );
3063
3064 var vnode = options.render.call(null, renderContext._c, renderContext);
3065
3066 if (vnode instanceof VNode) {
3067 return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
3068 } else if (Array.isArray(vnode)) {
3069 var vnodes = normalizeChildren(vnode) || [];
3070 var res = new Array(vnodes.length);
3071 for (var i = 0; i < vnodes.length; i++) {
3072 res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
3073 }
3074 return res
3075 }
3076 }
3077
3078 function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
3079 // #7817 clone node before setting fnContext, otherwise if the node is reused

Callers 1

createComponentFunction · 0.85

Calls 5

isDefFunction · 0.85
validatePropFunction · 0.85
mergePropsFunction · 0.85
normalizeChildrenFunction · 0.85

Tested by

no test coverage detected