请注意,我在根“静态”目录中包含一些 js 文件,如下所示。
head: {
script: [{
type: 'text/javascript',
src: 'js/jquery.min.js',
body: true
},
{
type: 'text/javascript',
src: 'js/bootstrap.min.js',
body: true
},
{
type: 'text/javascript',
src: 'js/slick.min.js',
body: true
},
{
type: 'text/javascript',
src: 'js/script.js',
body: true
}
]},
配置i18n如下
i18n: {
locales: [{
code: 'en',
name: 'English',
file: 'en-US.js'
},
{
code: 'ar',
name: 'Arabic',
file: 'ar-AR.js'
}
],
defaultLocale: 'en',
lazy: true,
langDir: 'lang/',
defaultLocale: 'en',
vueI18n: {
fallbackLocale: 'en'
}
},
使用 en 加载我的 js 文件没有问题,但是当我从 en 切换到 ar 时,浏览器控制台为我提供了静态目录中所有包含文件的以下错误。
GET http://localhost:3000/ar/js/jquery.min.js net::ERR_ABORTED 404 (Not Found)