runtime-dom.esm-bundler.js10 Uncaught (in promise) TypeError Cannot read property 'insertBefore' of null
2024年1月25日小于 1 分钟约 196 字
runtime-dom.esm-bundler.js:10 Uncaught (in promise) TypeError: Cannot read property 'insertBefore' of null
at insert (runtime-dom.esm-bundler.js:10)
at processCommentNode (runtime-core.esm-bundler.js:5063)
at patch (runtime-core.esm-bundler.js:5015)
at patchBlockChildren (runtime-core.esm-bundler.js:5350)
at patchElement (runtime-core.esm-bundler.js:5258)
at processElement (runtime-core.esm-bundler.js:5113)
at patch (runtime-core.esm-bundler.js:5030)
at ReactiveEffect.componentUpdateFn [as fn] (runtime-core.esm-bundler.js:5655)
at ReactiveEffect.run (reactivity.esm-bundler.js:185)
<!-- more -->
at instance.update (runtime-core.esm-bundler.js:5689)The "Cannot read property 'insertBefore' of null" error occurs for 2 reasons:
- Calling the
insertBeforemethod on anullvalue (DOM element that doesn't exist). - Inserting the JS script tag above the HTML where the DOM elements are declared.
最终是因为时许的问题,在渲染之前加v-if进行判断
