File tree 2 files changed +15
-2
lines changed
2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 1
1
<script setup lang="ts">
2
- import { useRuntimeConfig } from ' #imports'
2
+ import { useRuntimeConfig , useWithBase } from ' #imports'
3
3
import { useI18n } from ' #i18n'
4
4
import { useNav } from ' ~/composables/useNav'
5
5
import { useScreenOrientation , useWindowSize } from ' @vueuse/core'
@@ -36,8 +36,10 @@ const toggleMenu = () => {
36
36
showMenu .value = ! showMenu .value
37
37
}
38
38
39
+ const withBase = useWithBase ()
39
40
const getAnchorPath = computed (
40
- () => (anchor : string ) => (locale .value === ' ja' ? ` /${anchor } ` : ` /en/${anchor } ` ),
41
+ () => (anchor : string ) =>
42
+ locale .value === ' ja' ? withBase (` /${anchor } ` ) : withBase (` en/${anchor } ` ),
41
43
)
42
44
</script >
43
45
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