2023-05-07 16:38:23 +08:00
|
|
|
<script setup lang="ts">
|
2023-06-01 15:36:34 +08:00
|
|
|
const props = $defineProps<{
|
2023-05-07 16:38:23 +08:00
|
|
|
href?: string
|
|
|
|
}>()
|
|
|
|
|
|
|
|
const localePath = useLocalePath()
|
2023-06-01 15:36:34 +08:00
|
|
|
|
|
|
|
const { locale, locales, setLocale, defaultDirection } = useI18n()
|
|
|
|
|
|
|
|
function getPath() {
|
|
|
|
return locale.value === 'zh' ? props.href : `/en${props.href}`
|
|
|
|
}
|
2023-05-07 16:38:23 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2023-06-01 15:36:34 +08:00
|
|
|
<NuxtLink :href="getPath()">
|
|
|
|
<!-- <NuxtLink :href="href && localePath(href)"> -->
|
2023-05-07 16:38:23 +08:00
|
|
|
<slot />
|
|
|
|
</NuxtLink>
|
|
|
|
</template>
|