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

点击排序有问题 #29

Open
fengzi2016 opened this issue Jun 17, 2021 · 0 comments
Open

点击排序有问题 #29

fengzi2016 opened this issue Jun 17, 2021 · 0 comments

Comments

@fengzi2016
Copy link

examples/sort-tabel.html 每次点击之后都会生成一些新的元素,不符合预期。
原始的:
image
点击后:
image
这是因为 listDiff 产生的diffs 里的 moves 表示要将user5插入到index 0,将index = 1元素删除(也就是user1),将user1插入到index4
image

而这段代码中:
image
只插入了节点user5,没有删除节点user5

MDN中说insertBofore如果是已有DOM中的引用会调整位置,而不需要删除,这里没有起效果
image

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

1 participant