interview-answe icon indicating copy to clipboard operation
interview-answe copied to clipboard

197.[vue]组件的渲染与更新过程

Open webVueBlog opened this issue 4 years ago • 1 comments

[vue]

webVueBlog avatar Apr 21 '20 01:04 webVueBlog

1.组件渲染时,会通过 Vue.extend 方法构建子组件构造函数(原型继承的方法实现) 2.installComponentHooks 安装组件的钩子函数 init:初始化,prepatch:预补丁、insert:插入、destroy :销毁

3.用 new VNode 实例化(组件的 vNode 没有 children) 然后手动调用 $mount( ) 进行挂载 更新组件时 patchVnode 流程,其核心是 diff 算法

webVueBlog avatar Apr 21 '20 01:04 webVueBlog