We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
destroy
Artalk 在调用 destroy 方法时会调用 element.remove() 方法删除 HTML 元素(包含 root 元素),这会导致前端框架在更新时丢失 HTML 元素,从而无法重载 Artalk。
element.remove()
Artalk/ui/artalk/src/artalk.ts
Line 62 in b60cb58
https://stackblitz.com/edit/vitejs-vite-y5eqcb?file=src%2FApp.tsx&terminal=dev
Artalk UI:2.8.3 Artalk API:2.8.3
使用 element.innerHTML = '' 移除子元素,而不是使用 element.remove(),element.remove() 会将父元素(root)也一起移除。我可以为 Artalk 提 PR 来修复这个问题。
element.innerHTML = ''
另外,可以考虑为不同的前端框架制作 wrapper,降低集成 Artalk 的难度。
The text was updated successfully, but these errors were encountered:
非常感谢!!❤️ 这个 issue 真的很详细!
Sorry, something went wrong.
I meet the same issues in React. When can we get this fix released to npmjs.
@syhily Hello, v2.8.4 npm package has just been released, including this fix.
Successfully merging a pull request may close this issue.
Description
Artalk 在调用
destroy
方法时会调用element.remove()
方法删除 HTML 元素(包含 root 元素),这会导致前端框架在更新时丢失 HTML 元素,从而无法重载 Artalk。Artalk/ui/artalk/src/artalk.ts
Line 62 in b60cb58
Reproduction steps
destroy
方法情况下,Artalk 在框架更新或者初始化中都可以正常重载。destroy
方法,Artalk 无法被正常初始化或重载。Versions
Artalk UI:2.8.3
Artalk API:2.8.3
Possible solutions
使用
element.innerHTML = ''
移除子元素,而不是使用element.remove()
,element.remove()
会将父元素(root)也一起移除。我可以为 Artalk 提 PR 来修复这个问题。另外,可以考虑为不同的前端框架制作 wrapper,降低集成 Artalk 的难度。
Reference
The text was updated successfully, but these errors were encountered: