组件渲染
渲染管线:https://cn.vuejs.org/guide/extras/rendering-mechanism.html#render-pipeline
- 模板编译
- mount。首次挂载
- update。更新
- pre。比如 watch、watchEffect
- flushing。queueJob
- post。比如 onMounted
批处理是怎么实现的?
每个 effect 会有一个 id 标识,相同 id 的 effect 会合并
生命周期
参考
- https://cn.vuejs.org/api/composition-api-lifecycle.html
- https://juejin.cn/post/6997412902713950221
模板编译
h --> createVNode --> 真实 DOM
现在有这样一个模板
<div id="app">
<p>{
{name}}</p>
<p>{
{age}}</p>
</div>
vue 会基于 AST 将其编译成 render
函数,该函数会返回一个虚拟 DOM 对象
function rende