useSwitchLocalePath()
组合式函数返回一个可以切换语言环境的函数。
declare function useSwitchLocalePath(options?: I18nCommonRoutingOptionsWithComposable): (locale?: Locale) => string
<script setup>
const switchLocalePath = useSwitchLocalePath()
</script>
<template>
<NuxtLink :to="switchLocalePath('en')">英语</NuxtLink>
<NuxtLink :to="switchLocalePath('fr')">法语</NuxtLink>
</template>