Skip to content
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

diff数组时,如果数组元素被删除,diff会返回无更改,导致页面元素无法移除 #57

Closed
zhengguorong opened this issue Nov 28, 2018 · 2 comments

Comments

@zhengguorong
Copy link

diff算法会把两个对象做比对,如果是增改是没问题的,但是如果是删除操作,diff算法就没法抓出被删除的元素了。

@dntzhang
Copy link
Collaborator

删除的会设置成 null 啊

@zhengguorong
Copy link
Author

是我的问题,diff两对象时,第二参数和第一参数有引用关系,所以没diff出来。
现在先对参数二做个深拷贝,就可以解决了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants