使用vite + vue3构建的项目中,在路由后退的时候,控制台出现这样的报错:

runtime-dom.esm-bundler.js:10 Uncaught (in promise) DOMException: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.

通过查询资料得知是由于路由根节点存在多个节点导致的,只要是的根节点只有一个dom元素既可解决。

调整为:

 

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐