Zi18nZ
Vue 翻译插件
安装
npm i zi18nz
配置
//国际化import Zi18nZ from "zi18nz"Vue.use(Zi18nZ)
教程
例子
<template> <div>{{$t("test")}}</div></template> <script> export default { name: "Dome", data(){ return { //局部语言模板 $t_t:{ en:{ test:"test" }, cn:{ test:"测试" }, //.... } } }, mounted(){ //设置语言 this.action({ moduleName:'$t', goods:'en' }); //设置全局语言模板 //创建 @/langs/index.js 文件,配置文件 /*示例:index.js export default { en:{ //... }, cn:{ //... } //.... } */ } }</script> <style scoped> </style>