We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 8419912 + 84c7d28 commit 115bc8cCopy full SHA for 115bc8c
apps/web/app/components/TopPageSection.vue
@@ -1,11 +1,15 @@
1
<script setup lang="ts">
2
import { useI18n } from '#i18n'
3
import { computed } from 'vue'
4
+import { useWithBase } from '#imports'
5
6
const { locale } = useI18n()
7
8
+const withBase = useWithBase()
9
+
10
const getAnchorPath = computed(
- () => (anchor: string) => (locale.value === 'ja' ? `/${anchor}` : `/en/${anchor}`),
11
+ () => (anchor: string) =>
12
+ locale.value === 'ja' ? withBase(`/${anchor}`) : withBase(`/en/${anchor}`),
13
)
14
</script>
15
apps/web/app/composables/useWithBase.ts
@@ -0,0 +1,11 @@
+import { useRuntimeConfig } from '#app'
+export function useWithBase() {
+ const baseUrl = useRuntimeConfig().app.baseURL
+ function withBase(path: string) {
+ return (baseUrl + path).replace(/\/\//g, '/')
+ }
+ return withBase
+}
0 commit comments