# 如何绕过导航时的DOMContentLoaded

**URL:** <https://meta.discourse.org/t/how-to-get-around-domcontentloaded-for-navigation/351748>\
**Category:** Development\
**Created:** [2025年二月11日 21:38 UTC](https://meta.discourse.org/t/how-to-get-around-domcontentloaded-for-navigation/351748 "2025-02-11T21:38:15Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)\
**Post date:** [2025年二月11日 22:05 UTC](https://meta.discourse.org/t/how-to-get-around-domcontentloaded-for-navigation/351748/3 "2025-02-11T22:05:38Z")

</div>

嗯……我不确定这是否能保证 DOM 内容已加载，我相信它会在路由更改时触发，这要早得多。

如果 DOM 加载很重要，您需要考虑将组件附加到插件插槽并使用 `didInsert` 修饰符触发。

如果仅路由更改很重要，那么是的，`onPageChange` 应该可以做到 👍

---

_[View the full topic](https://meta.discourse.org/t/how-to-get-around-domcontentloaded-for-navigation/351748)._
