组合式函数
useSwitchLocalePath
useSwitchLocalePath() 组合函数返回一个可以切换语言环境的函数。
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>