Afe Notes
Results
1
comments of
Afe Notes
@ustbhuangyi 大神回复如下: 你这个问题的原因定位了,首先 li 包裹的文本元素会在 createElm 阶段创建 vnode.elm = nodeOps.createTextNode(vnode.text),然后你用 jQuery 修改了这个文本节点,文本就已经变了。由于你的 v-for 的 key 是 index,那么在 patch 过程中,新旧 li 始终被认为是 sameVnode,也就会执行 patchVnode 方法更新,对于文本节点,最后会更新 else if (oldVnode.text !== vnode.text) {...