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

Function invokeCreateHooks

vue.js:8356–8390  ·  view source on GitHub ↗
(vnode, insertedVnodeQueue)

Source from the content-addressed store, hash-verified

8354
8355 // invokeCreateHooks,循环cbs.create 钩子函数,并且执行调用,其实cbs.create 钩子函数就是platformModules中的attrs中 updateAttrs更新属性函数。如果是组件则调用componentVNodeHooks中的 create
8356 function invokeCreateHooks(vnode, insertedVnodeQueue) {
8357 // 这里的cbs如下:
8358 /*
8359 cbs={
8360 'create':[],
8361 'activate':[],
8362 'update':[],
8363 'remove':[],
8364 'destroy:[]
8365 }
8366 */
8367 // activate:Array(1)
8368 // create:Array(8)
8369 // destroy:Array(2)
8370 // remove:Array(1)
8371 // update:Array(7)
8372 // __proto__:Object
8373 console.log('==cbs.create==')
8374 console.log(cbs)
8375 for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
8376
8377 cbs.create[i$1](emptyNode, vnode);
8378 }
8379 i = vnode.data.hook; // Reuse variable 如果他是组件
8380 console.log(i)
8381 // 如果是组件则调用componentVNodeHooks中的 create
8382 if (isDef(i)) {
8383 if (isDef(i.create)) { //但是componentVNodeHooks 中没有create 所以下面可能不会执行
8384 i.create(emptyNode, vnode);
8385 }
8386 if (isDef(i.insert)) {
8387 insertedVnodeQueue.push(vnode);
8388 }
8389 }
8390 }
8391
8392 // set scope id attribute for scoped CSS.
8393 // this is implemented as a special case to avoid the overhead

Callers 3

createElmFunction · 0.85
initComponentFunction · 0.85
hydrateFunction · 0.85

Calls 1

isDefFunction · 0.85

Tested by

no test coverage detected