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