vue international di

参考:http://kazupon.github.io/vue-i18n/zh/introduction.html
npm install vue-i18n

In the main.ts

// multiple language switching 
Import VueI18n from 'the i18n-VUE' 
Vue.use (VueI18n) 
const the i18n = new new VueI18n ({ 
    the locale: 'ZH', // language identification 
    messages: {
         'ZH': the require ( './ Assets / lang / ZH ' ),
         ' EN ': the require (' ./ Assets / lang / EN ' ) 
    } 
})

new Vue({
i18n,
router,
store,
render: h => h(App)
}).$mount('#app')

globalization

And establishing zh.js en.js follows to 
module.exports = { lang: [ {label: "Chinese", value: "ZH" }, {label: "Dictionary Dictionary English", value: "EN" } ], Home : { title: "you know of The More, The More you win" }, content: { main: "this is the content" } }

use

<p class="big_title">{{$t('home.title')}}</p>

js中使用 this.$t('home.title')}

Guess you like

Origin www.cnblogs.com/mary-123/p/12128589.html