Files
moeka-project/docs/.vitepress/components/HomeButton.vue
T
Garfield Lee 9538068d0b fix(docs): Try Live leads to 404 in VitePress SPA router (#1461)
- Add `target?: string` field to `ButtonItem` interface
- Set `target: '_self'` on all locales' Try Live button configs (EN, ZH, JA)
- Bind `:target="item.target"` on the `<a>` element in HomeButton.vue

VitePress intercepts clicks on anchor tags without an explicit `target`
attribute and routes them through Vue Router, which causes a 404 for the
external https://airi.moeru.ai/ link. Setting `target="_self"` makes
the browser skip the router and perform a native navigation.

Co-authored-by-agent: GitHub Copilot <copilot@github.com>
2026-03-24 10:15:57 +08:00

29 lines
712 B
Vue

<script setup lang="ts">
import type { ButtonItem } from '../theme/config.ts'
defineProps<{
item: ButtonItem
}>()
</script>
<template>
<a
:target="item.target"
:href="item.link"
:class="[
'rounded-xl px-3 py-2 lg:px-5 lg:py-3 font-extrabold outline-none backdrop-blur-md active:scale-95 focus:outline-none text-nowrap text-sm md:text-base',
'text-slate-700 dark:text-slate-100',
'transition-colors,transform',
'duration-200 ease-in-out',
item.primary ? 'bg-primary/20 dark:bg-primary/30 dark:hover:bg-primary/40' : 'bg-black/4 dark:bg-white/20 dark:hover:bg-white/30',
]"
cursor-pointer
>
{{ item.text }}
</a>
</template>
<style scoped>
</style>