diff --git a/.vitepress/theme/components/VideoSection.vue b/.vitepress/theme/components/VideoSection.vue index 3d71f46..21aeb0d 100644 --- a/.vitepress/theme/components/VideoSection.vue +++ b/.vitepress/theme/components/VideoSection.vue @@ -1,9 +1,15 @@ @@ -11,7 +17,20 @@ defineProps<{ {{ title }} {{ description }} + \ No newline at end of file + diff --git a/.vitepress/theme/index.ts b/.vitepress/theme/index.ts index 1fb8a22..a206f4b 100644 --- a/.vitepress/theme/index.ts +++ b/.vitepress/theme/index.ts @@ -1,8 +1,8 @@ // https://vitepress.dev/guide/custom-theme import type { EnhanceAppContext, Theme } from 'vitepress'; -import { useData } from 'vitepress'; +import { useData, useRouter } from 'vitepress'; import DefaultTheme from 'vitepress/theme'; -import { h } from 'vue'; +import { h, onMounted, watch } from 'vue'; import '@theojs/lumen/style'; import { BoxCube, Card, CopyText, Links, Pill } from '@theojs/lumen'; import { getFooterData, getMessages, type Lang } from '../data/i18n'; @@ -27,7 +27,7 @@ export default { }, }); }, - enhanceApp: ({ app }: EnhanceAppContext) => { + enhanceApp: ({ app, router }: EnhanceAppContext) => { // 注册 lumen 组件 app.component('BoxCube', BoxCube); app.component('Card', Card); @@ -41,5 +41,19 @@ export default { app.component('VideoSection', VideoSection); app.component('HomeUnderline', HomeUnderline); app.component('ImageGallery', ImageGallery); + + if (typeof window !== 'undefined') { + router.onAfterRouteChanged = (to: string) => { + setTimeout(() => { + if ((window as any).umami) { + (window as any).umami.track((props: any) => ({ + ...props, + url: to, + referrer: document.referrer, + })); + } + }, 100); + }; + } }, } satisfies Theme; diff --git a/src/en/index.md b/src/en/index.md index 53e1864..5f0bc59 100644 --- a/src/en/index.md +++ b/src/en/index.md @@ -13,7 +13,7 @@ hero: alt: PCL CE actions: - theme: brand - text: Download + text: Download Now link: /en/download - theme: alt text: Learn More @@ -44,8 +44,8 @@ features:
{{ description }}