如何在nuxt-i18n下同时并行使用以下nuxt-link:
<nuxt-link :to="switchLocalePath('en')">EN</nuxt-link>
和
<nuxt-link :to="localePath('/about')">About</nuxt-link>
因此,当我更改语言时,它会自动将我放入“关于”页面。
发布于 2021-05-09 23:12:46
您可以在链接上使用@click,如下所示
<nuxt-link :to="switchLocalePath('en')" @click="$router.push(localePath('/about'))">EN</nuxt-link>取自以下来源:https://github.com/nuxt-community/i18n-module/issues/476#issuecomment-539451906
发布于 2021-05-10 00:44:12
谢谢你的建议!
不幸的是,nuxt-link似乎不能与@click一起工作,但当我嵌套它时,它可以正常工作,如下所示:
<div @click="$router.push(localePath('/about'))">
<nuxt-link class="text-header-bold text-middle" :to="switchLocalePath('en')">EN</nuxt-link>
</div>https://stackoverflow.com/questions/67459010
复制相似问题