From e558af6ca092433df057ad22710d8f6b1dd6ba37 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Tue, 14 Jul 2026 13:32:13 +0800 Subject: [PATCH] docs: improve enhanceApp usecases (#5315) --- docs/en/guide/custom-theme.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/en/guide/custom-theme.md b/docs/en/guide/custom-theme.md index 8de4c7ab..5811ad14 100644 --- a/docs/en/guide/custom-theme.md +++ b/docs/en/guide/custom-theme.md @@ -62,11 +62,14 @@ import Layout from './Layout.vue' export default { Layout, enhanceApp({ app, router, siteData }) { - // ... + // app.component(...) + // app.use(...) } } ``` +The `enhanceApp` hook allows you to access the [Vue app instance](https://vuejs.org/api/application.html) and other runtime data, which can be used to [register global components](./extending-default-theme.md#registering-global-components), integrate with Vue libraries, etc. + The `router` value is the same VitePress router instance returned by [`useRouter()`](../reference/runtime-api#userouter). To listen for route changes, assign handlers on the router: ```ts [.vitepress/theme/index.ts]