smy-lang-loader
v0.0.1
Published
用来自动化生成不同语言文件的loader
Downloads
5
Maintainers
Readme
说明
用来自动化生成不同语言文件的loader
安装
npm install --save-dev smy-lang-loader
使用
config.module
.rule('vue')
.use('vue-loader')
.loader('vue-loader')
.tap(options => {
options.compilerOptions.preserveWhitespace = true
return options
})
.end()
.use('lang-loader')
.loader('lang-loader')
.options({
outputDir: path.resolve(__dirname, './src/utils/i18n/languages/'),
outputFiles: [
{
lang: 'zh',
file: 'ces.js'
}
]
})
.end()
代码内部使用,配合i18n:
<el-form-item :label="$t('dbUrl=你再搞啥子w1z')" prop="jdbcUrl">
</el-form-item>
提供两个入参outputDir和outputFiles outputDir: 输出目录 outputFiles: 输出文件 outputFiles包含两个属性,lang和file lang: 语言 file: 文件名