zi18nz

0.0.7 • Public • Published

Zi18nZ npm github

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>
具体方法及配置请查看源代码

Readme

Keywords

none

Package Sidebar

Install

npm i zi18nz

Weekly Downloads

0

Version

0.0.7

License

ISC

Unpacked Size

20.7 kB

Total Files

11

Last publish

Collaborators

  • zys