MCPcopy
hub / github.com/ygs-code/vue / createChildren

Function createChildren

vue.js:8310–8344  ·  view source on GitHub ↗
(
            vnode, //虚拟dom
            children,  //子节点
            insertedVnodeQueue //插入Vnode队列
        )

Source from the content-addressed store, hash-verified

8308
8309 //创建子节点
8310 function createChildren(
8311 vnode, //虚拟dom
8312 children, //子节点
8313 insertedVnodeQueue //插入Vnode队列
8314 ) {
8315 console.log('==children==')
8316 console.log(children)
8317
8318 if (Array.isArray(children)) { //如果children 是数组
8319 {
8320 //检测key是否有重复
8321 checkDuplicateKeys(children);
8322 }
8323 //创造节点
8324 for (var i = 0; i < children.length; ++i) {
8325 //创造节点
8326 createElm(
8327 children[i], //vnode 节点
8328 insertedVnodeQueue, //插入Vnode队列
8329 vnode.elm, //父亲节点
8330 null, //当前节点
8331 true, //嵌套
8332 children, //主数组 节点
8333 i //索引
8334 );
8335 }
8336 //判断数据类型是否是string,number,symbol,boolean
8337 } else if (isPrimitive(vnode.text)) {
8338 //添加子节点 创建一个文本节点
8339 nodeOps.appendChild(
8340 vnode.elm,
8341 nodeOps.createTextNode(String(vnode.text)) //创建文本节点真是dom节点
8342 );
8343 }
8344 }
8345
8346 //循环组件实例 是否定义有 tag标签
8347 function isPatchable(vnode) {

Callers 2

createElmFunction · 0.85
hydrateFunction · 0.85

Calls 3

checkDuplicateKeysFunction · 0.85
createElmFunction · 0.85
isPrimitiveFunction · 0.85

Tested by

no test coverage detected