MCPcopy Index your code
hub / github.com/ygs-code/vue / FunctionalRenderContext

Function FunctionalRenderContext

vue.js:5727–5816  ·  view source on GitHub ↗
(
        data, // vonde 虚拟dom的属性数据
        props,  //props 属性 包含值和key
        children, //子节点
        parent, //vm vue实例化,如果parent也组件 也可能是VueComponent 构造函数 实例化的对象
        Ctor  //VueComponent 构造函数
    )

Source from the content-addressed store, hash-verified

5725 *
5726 * */
5727 function FunctionalRenderContext(
5728 data, // vonde 虚拟dom的属性数据
5729 props, //props 属性 包含值和key
5730 children, //子节点
5731 parent, //vm vue实例化,如果parent也组件 也可能是VueComponent 构造函数 实例化的对象
5732 Ctor //VueComponent 构造函数
5733 ) {
5734 console.log([
5735 data, // vonde 虚拟dom的属性数据
5736 props, //props 属性
5737 children, //子节点
5738 parent, //vm
5739 Ctor //VueComponent 构造函数
5740 ])
5741
5742 var options = Ctor.options;
5743 // ensure the createElement function in functional components
5744 // gets a unique context - this is necessary for correct named slot check
5745 //确保函数组件中的createElement函数
5746 // 获取唯一上下文——这对于正确的命名槽检查是必要的
5747 var contextVm;
5748 console.log(hasOwn(parent, '_uid'))
5749 if (hasOwn(parent, '_uid')) { //判断这个组件是否是 new _init 过
5750 contextVm = Object.create(parent); //创建一个对象
5751 // $flow-disable-line 流禁用线
5752 contextVm._original = parent;
5753 } else {
5754 // the context vm passed in is a functional context as well.
5755 // in this case we want to make sure we are able to get a hold to the
5756 // real context instance.
5757 //传入的上下文vm也是一个功能上下文。
5758 //在这种情况下,我们想确定一下我们能否得到
5759 //真实的上下文实例。
5760 contextVm = parent;
5761 // $flow-disable-line
5762 parent = parent._original;
5763 }
5764 var isCompiled = isTrue(options._compiled); // 判断是否是模板编译
5765 var needNormalization = !isCompiled; //如果不是模板编译
5766
5767 // data, // vonde 虚拟dom的数据
5768 // props, //props 属性
5769 // children, //子节点
5770 // parent, //vm
5771 // Ctor //VueComponent 构造函数
5772
5773 this.data = data; // vonde 虚拟dom的数据
5774 this.props = props; // props 属性
5775 this.children = children; //子节点
5776 this.parent = parent; //vm
5777 this.listeners = data.on || emptyObject; // 事件
5778 // inject 选项应该是一个字符串数组或一个对象,该对象的 key 代表了本地绑定的名称,value 为其 key (字符串或 Symbol) 以在可用的注入中搜索。
5779 this.injections = resolveInject(options.inject, parent);
5780 this.slots = function () { //插槽
5781 // 判断children 有没有分发式插槽 并且过滤掉空的插槽
5782 return resolveSlots(children, parent);
5783 };
5784

Callers

nothing calls this directly

Calls 5

hasOwnFunction · 0.85
isTrueFunction · 0.85
resolveInjectFunction · 0.85
resolveSlotsFunction · 0.85
createElementFunction · 0.85

Tested by

no test coverage detected