hooks
strats
对象上添加如下11
个钩子函数,并进行对应的hooks合并
beforeCreate
created
beforeMount
mounted
beforeUpdate
updated
beforeDestroy
destroyed
activated
deactivated
errorCaptured
分析:
如果
childVal
不存在,返回parentVal
(数组);否则,进入下一个判断,判断
parentVal
(数组)是否存在,如果存在,parentVal
拼接childVal
;否则,进入下一个判断, 判断
childVal
是否是数组,如果是,直接返回childVal
,否则,把childVal
变成数组。
遍历定义好的钩子常量,并对每个钩子常量添加mergeHook
方法进行hooks合并:
Last updated
Was this helpful?