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

insertAfter 插入节点到根,抛出异常 #7

Closed
axetroy opened this issue Aug 31, 2022 · 3 comments
Closed

insertAfter 插入节点到根,抛出异常 #7

axetroy opened this issue Aug 31, 2022 · 3 comments
Labels
invalid This doesn't seem right

Comments

@axetroy
Copy link

axetroy commented Aug 31, 2022

截屏2022-08-31 17 19 17

截屏2022-08-31 17 20 04

对于根节点,有点奇怪

@axetroy
Copy link
Author

axetroy commented Aug 31, 2022

只需要改一改,即可修复

    getChildren(forceInit = false) {
        // this is data
-        if (this.level === 0) return this.data
+        if (this.level === 0) return this.childNodes.map(v => v.data)

@wchbrad wchbrad added the bug Something isn't working label Sep 1, 2022
@wchbrad
Copy link
Owner

wchbrad commented Sep 1, 2022

是个可能的问题,感谢修复,我根据你这个测试一下

@wchbrad
Copy link
Owner

wchbrad commented Oct 12, 2022

你好,我使用 插入节点到根 的insertAfter方法,未发现问题,是否未按照insertAfter的以下所述方法使用而导致的报错?

  • (data, refNode) 接收两个参数,1. 要增加的节点的 data 2. 要增加的节点的前一个节点的 data、key 或者 node

附测试gif
df

如有问题,请提交最小可重现代码,感谢

@wchbrad wchbrad added invalid This doesn't seem right and removed bug Something isn't working labels Oct 12, 2022
@wchbrad wchbrad closed this as completed Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants