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>
This commit is contained in:
@@ -8,6 +8,7 @@ defineProps<{
|
||||
|
||||
<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',
|
||||
|
||||
@@ -213,6 +213,7 @@ export default defineConfig<ThemeConfig>({
|
||||
text: 'Try Live',
|
||||
link: webLive,
|
||||
primary: true,
|
||||
target: '_self',
|
||||
},
|
||||
{
|
||||
text: 'Download',
|
||||
@@ -353,6 +354,7 @@ export default defineConfig<ThemeConfig>({
|
||||
text: '网页版',
|
||||
link: webLive,
|
||||
primary: true,
|
||||
target: '_self',
|
||||
},
|
||||
{
|
||||
text: '下载',
|
||||
@@ -493,6 +495,7 @@ export default defineConfig<ThemeConfig>({
|
||||
text: 'ライブ版を試す',
|
||||
link: webLive,
|
||||
primary: true,
|
||||
target: '_self',
|
||||
},
|
||||
{
|
||||
text: 'ダウンロード',
|
||||
@@ -513,7 +516,6 @@ export default defineConfig<ThemeConfig>({
|
||||
{ icon: 'discord', link: discord },
|
||||
{ icon: 'github', link: github },
|
||||
],
|
||||
|
||||
search: {
|
||||
provider: 'local',
|
||||
},
|
||||
|
||||
@@ -12,6 +12,7 @@ export interface ButtonItem {
|
||||
text?: string
|
||||
link?: string
|
||||
primary?: boolean
|
||||
target?: string
|
||||
}
|
||||
|
||||
export type ThemeConfig = DefaultTheme.Config & ExtraThemeConfig
|
||||
|
||||
Reference in New Issue
Block a user