File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 11<script setup lang="ts">
2- import { useRuntimeConfig } from ' #imports'
2+ import { useRuntimeConfig , useWithBase } from ' #imports'
33import { useI18n } from ' #i18n'
44import { useNav } from ' ~/composables/useNav'
55import { useScreenOrientation , useWindowSize } from ' @vueuse/core'
@@ -36,8 +36,10 @@ const toggleMenu = () => {
3636 showMenu .value = ! showMenu .value
3737}
3838
39+ const withBase = useWithBase ()
3940const getAnchorPath = computed (
40- () => (anchor : string ) => (locale .value === ' ja' ? ` /${anchor } ` : ` /en/${anchor } ` ),
41+ () => (anchor : string ) =>
42+ locale .value === ' ja' ? withBase (` /${anchor } ` ) : withBase (` en/${anchor } ` ),
4143)
4244 </script >
4345
Original file line number Diff line number Diff line change 1+ import { useRuntimeConfig } from '#app'
2+
3+ export function useWithBase ( ) {
4+ const baseUrl = useRuntimeConfig ( ) . app . baseURL
5+
6+ function withBase ( path : string ) {
7+ return ( baseUrl + path ) . replace ( / \/ \/ / g, '/' )
8+ }
9+
10+ return withBase
11+ }
You can’t perform that action at this time.
0 commit comments