1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

fix: 修复教程简介中链接点击跳转 URL 缺少 base URL 问题

This commit is contained in:
2025-03-14 00:21:38 +08:00
parent d9e436b04e
commit 82684043bc
3 changed files with 10 additions and 2 deletions

View File

@@ -29,6 +29,7 @@
<script setup lang="ts">
import { useRouter, DefaultTheme } from 'vitepress';
import { base } from '../env.mts';
const props = defineProps<{
base?: string,
@@ -38,7 +39,8 @@ const props = defineProps<{
const router = useRouter()
function goTo(link: string) {
const target = (props.base || '') + link?.replace('.md', '.html')
const baseUrl = (base.endsWith('/') ? base.substring(0, base.length - 1) : base)
const target = baseUrl + (props.base || '') + link?.replace('.md', '.html')
console.log('base', props.base)
console.log('link', link)
console.log('target', target)