问题描述
我有一个使用3种语言的Nuxt.js应用程序:默认是英语,并且我已经配置nuxt-i18n来处理法语和西班牙语。
我的问题如下:在开发模式下,运行nuxt dev
后,默认语言基于浏览器,因此默认情况下http://localhost:3000/
将我重定向到英文版本http://localhost:3000/fr
表示法语,http://localhost:3000/es
表示西班牙语。
当我在暂存环境(使用nginx)中部署到Web服务器时,我使用nuxt generate
。在这种情况下,正确配置了默认路由https://mysite-staging.com,但是对于法语,我得到了https://mysite-staging.com/fr/index.html和https://mysite-staging.com/es/index.html对于西班牙语。
为什么默认语言之外的所有内容都带有index.html前缀?
我认为提交表单时也是一个问题,我被重定向到
https://mysite-staging.com/fr/index.html?
即使我指定了submit.prevent
。
我在 nuxt.config.js中拥有此配置。
/*
** Nuxt.js modules
*/
modules: [
[
'nuxt-i18n',{
baseUrl: 'https://www.fendcer.com',defaultLocale: 'en',locales: [
{
code: 'en',iso: 'en-US',file: 'en-US.js',},{
code: 'fr',iso: 'fr-FR',file: 'fr-FR.js',{
code: 'es',iso: 'es-ES',file: 'es-ES.js',],lazy: true,langDir: 'lang/',
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)