-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vue原理问题讨论, 关于vue与原生js混用 #69
Comments
@ustbhuangyi 大神回复如下: 通常是不建议 v-for 的 key 用 index,坑比较多,删除节点的时候会遇到 感谢大神!!! |
这个问题很有趣,原理就像大神所说的之前的文本节点对象已经被jquery给更改了,所以为了不让其更改文本节点对象,可以直接更改文本节点的textContent,这样就可以避免第一个元素不更新的问题了 |
代码如下:
https://jsfiddle.net/afenotes/bkjxvr07/
初始渲染结果:
3s后,渲染结果:
6s后,实际渲染结果:
期望结果:
为什么第一个元素没有更新?猜测virtual dom到真实dom之间的映射丢了,求指点。
(知道这个混用不对,好奇背后的原理)
The text was updated successfully, but these errors were encountered: