处理Element
const processElement = (
n1,
n2,
container,
anchor,
parentComponent,
parentSuspense,
isSVG,
optimized
) => {
isSVG = isSVG || n2.type === 'svg'
if (n1 == null) {
mountElement(
n2,
container,
anchor,
parentComponent,
parentSuspense,
isSVG,
optimized
)
} else {
patchElement(n1, n2, parentComponent, parentSuspense, isSVG, optimized)
}
}
总结:
该方法主要是做了2件事情:
- 不存在旧节点,挂载
- 存在旧节点,更新,执行
patchElement